about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--home/profiles/gui/scripts/aeroplane-mode.nix12
1 files changed, 5 insertions, 7 deletions
diff --git a/home/profiles/gui/scripts/aeroplane-mode.nix b/home/profiles/gui/scripts/aeroplane-mode.nix
index 9f09c05..0b1ecf3 100644
--- a/home/profiles/gui/scripts/aeroplane-mode.nix
+++ b/home/profiles/gui/scripts/aeroplane-mode.nix
@@ -1,15 +1,13 @@
 ''
 set -euo pipefail
 
-rfkill_soft=$(rfkill -ro soft | tail -n +2 | sort -u)
+radio_status=$(nmcli radio | tail -n +2 | awk 'OFS="\n" {print $2,$4}' | sort -u)
 
-rfkill toggle all
-
-if [[ $rfkill_soft == "unblocked"  ]]; then
+if [[ $radio_status == "enabled" ]]; then
+    nmcli radio all off
     notify-send --urgency=critical "Aeroplane mode ACTIVATED"
-elif [[ $rfkill_soft == "blocked" ]]; then
-    notify-send --urgency=critical "Aeroplane mode DEACTIVATED"
 else
-    notify-send --urgency=critical "WARN: RFKill was in inconsistent state. Aeroplane mode ACTIVATED"
+    nmcli radio all on
+    notify-send --urgency=low "Aeroplane mode DEACTIVATED"
 fi
 ''