summaryrefslogtreecommitdiff
path: root/ar/.local/bin/ethwifi
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-28 04:38:47 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-28 04:38:47 +0900
commite1d11637f1e2e6151e261ad43ef699e314784253 (patch)
tree2702d30bab9aacd1b89bb081402977c6d01698ad /ar/.local/bin/ethwifi
parentda2bbf49b75a0d3f05ebe9b9559ef186ddd947cb (diff)
modified bin/bookmarks, modified bin/dmenurecord, modified bin/ethwifi, modified statusbar/sb-internet
Diffstat (limited to 'ar/.local/bin/ethwifi')
-rwxr-xr-xar/.local/bin/ethwifi21
1 files changed, 18 insertions, 3 deletions
diff --git a/ar/.local/bin/ethwifi b/ar/.local/bin/ethwifi
index 1f76ace..26366e9 100755
--- a/ar/.local/bin/ethwifi
+++ b/ar/.local/bin/ethwifi
@@ -8,9 +8,24 @@ check_ethernet() {
return 1
}
-check_ethernet && nmcli radio wifi off && notify-send "📡 wifi: OFF" || {
- nmcli radio wifi on
- notify-send "📡 wifi: ON"
+toggle_wifi() {
+ wifi_status=$(nmcli radio wifi) # Get current Wi-Fi status
+ if [ "$wifi_status" = "enabled" ]; then
+ nmcli radio wifi off
+ notify-send "📡 wifi: OFF"
+ else
+ nmcli radio wifi on
+ notify-send "📡 wifi: ON"
+ fi
}
+# Check Ethernet and toggle Wi-Fi based on its status
+if check_ethernet; then
+ nmcli radio wifi off
+ notify-send "📡 wifi: OFF (Ethernet connected)"
+else
+ toggle_wifi
+fi
+
+# Refresh status bar
pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"