diff options
author | sefidel <contact@sefidel.net> | 2024-08-28 02:27:43 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2024-08-28 02:27:43 +0900 |
commit | e6d4c93a310f3244f4c5c97b7dfa680c85f378c0 (patch) | |
tree | df434a2a8ce39dc266f93bb50e09ff835e854056 | |
parent | 63d4ae56d12dbe746c9bccfe35a32ac1eccf1928 (diff) | |
download | nixrc-e6d4c93a310f3244f4c5c97b7dfa680c85f378c0.tar.gz nixrc-e6d4c93a310f3244f4c5c97b7dfa680c85f378c0.zip |
feat(home/gui): aeroplane-mode: use nmcli instead of rfkill
-rw-r--r-- | home/profiles/gui/scripts/aeroplane-mode.nix | 12 |
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 '' |