Files
nwg-panel/nwg_panel/executors/airplane_mode.py
2024-05-02 00:55:37 +02:00

19 lines
409 B
Python
Executable File

#!/usr/bin/python3
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")
print("")
break