Files
dotfiles/nwg-panel/executors/airplane_mode.py
2025-01-10 15:27:20 +01: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