diff options
Diffstat (limited to 'config/hypr/scripts/AirplaneMode.sh')
| -rwxr-xr-x | config/hypr/scripts/AirplaneMode.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/config/hypr/scripts/AirplaneMode.sh b/config/hypr/scripts/AirplaneMode.sh index e0337dc7..f3a50629 100755 --- a/config/hypr/scripts/AirplaneMode.sh +++ b/config/hypr/scripts/AirplaneMode.sh @@ -2,11 +2,13 @@ notif="$HOME/.config/swaync/images/bell.png" -wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')" -if [ "$wifi" == "enabled" ]; then - rfkill block all & - notify-send -u low -i "$notif" 'airplane mode: active' +# Check if any wireless device is blocked +wifi_blocked=$(rfkill list wifi | grep -o "Soft blocked: yes") + +if [ -n "$wifi_blocked" ]; then + rfkill unblock wifi + notify-send -u low -i "$notif" 'Airplane mode: OFF' else - rfkill unblock all & - notify-send -u low -i "$notif" 'airplane mode: inactive' + rfkill block wifi + notify-send -u low -i "$notif" 'Airplane mode: ON' fi |
