aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/AirplaneMode.sh
diff options
context:
space:
mode:
authorJa.KooLit <ejhay.games@gmail.com>2023-12-29 01:26:59 +0900
committerJa.KooLit <ejhay.games@gmail.com>2023-12-29 01:26:59 +0900
commitdcbb02b43a80e2be6ac2b77a4775b7df623d4809 (patch)
tree7bd7709e9fac8064afde15d0d92ba0213e4b6c1e /config/hypr/scripts/AirplaneMode.sh
parent5765fdb2c1757aefbf5d7bcafc0fc9b7ad94bf79 (diff)
adjustments of scripts
Diffstat (limited to 'config/hypr/scripts/AirplaneMode.sh')
-rwxr-xr-xconfig/hypr/scripts/AirplaneMode.sh14
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage