about summary refs log tree commit diff
path: root/home/profiles/gui
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-08-28 02:27:43 +0900
committersefidel <contact@sefidel.net>2024-08-28 02:27:43 +0900
commite6d4c93a310f3244f4c5c97b7dfa680c85f378c0 (patch)
treedf434a2a8ce39dc266f93bb50e09ff835e854056 /home/profiles/gui
parent63d4ae56d12dbe746c9bccfe35a32ac1eccf1928 (diff)
downloadnixrc-e6d4c93a310f3244f4c5c97b7dfa680c85f378c0.tar.gz
nixrc-e6d4c93a310f3244f4c5c97b7dfa680c85f378c0.zip
feat(home/gui): aeroplane-mode: use nmcli instead of rfkill
Diffstat (limited to 'home/profiles/gui')
-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
 ''