add airplane_mode.py script
This commit is contained in:
18
nwg_panel/executors/airplane_mode.py
Executable file
18
nwg_panel/executors/airplane_mode.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
def get_output(cmd):
|
||||
try:
|
||||
return subprocess.check_output(cmd, shell=True).decode("utf-8").strip().splitlines()
|
||||
except subprocess.CalledProcessError:
|
||||
return ""
|
||||
|
||||
|
||||
o = get_output("rfkill list")
|
||||
for line in o:
|
||||
if "Soft blocked: yes" in line or "Hard blocked: yes" in line:
|
||||
print("airplane-mode-symbolic.svg")
|
||||
print("")
|
||||
break
|
Reference in New Issue
Block a user