add airplane_mode.py script

This commit is contained in:
piotr
2024-04-01 01:28:26 +02:00
parent f08fac6fb1
commit f229cf9bda

View 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