From e6d4c93a310f3244f4c5c97b7dfa680c85f378c0 Mon Sep 17 00:00:00 2001 From: sefidel Date: Wed, 28 Aug 2024 02:27:43 +0900 Subject: feat(home/gui): aeroplane-mode: use nmcli instead of rfkill --- home/profiles/gui/scripts/aeroplane-mode.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'home/profiles/gui') 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 '' -- cgit 1.4.1