From e1d11637f1e2e6151e261ad43ef699e314784253 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Tue, 28 Jan 2025 04:38:47 +0900 Subject: modified bin/bookmarks, modified bin/dmenurecord, modified bin/ethwifi, modified statusbar/sb-internet --- ar/.local/bin/ethwifi | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'ar/.local/bin/ethwifi') 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}" -- cgit v1.2.3