From 28e8bdf7f8286bd431b7f3b709e79f3827b31469 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:54:03 +0900 Subject: updates --- debian/.local/bin/ethwifi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 debian/.local/bin/ethwifi (limited to 'debian/.local/bin/ethwifi') diff --git a/debian/.local/bin/ethwifi b/debian/.local/bin/ethwifi new file mode 100755 index 0000000..26366e9 --- /dev/null +++ b/debian/.local/bin/ethwifi @@ -0,0 +1,31 @@ +#!/bin/sh + +check_ethernet() { + interfaces=$(ip link | awk '/^[0-9]+: e/ {print substr($2, 1, length($2)-1)}') + for iface in $interfaces; do + ip link show "$iface" | grep -q 'state UP' && return 0 + done + return 1 +} + +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