diff --git a/home-manager/modules/xmonad/scripts/auxmenu.sh b/home-manager/modules/xmonad/scripts/auxmenu.sh index edc9487..ba74e98 100644 --- a/home-manager/modules/xmonad/scripts/auxmenu.sh +++ b/home-manager/modules/xmonad/scripts/auxmenu.sh @@ -10,19 +10,24 @@ then wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ;; toggle-wifi) - if [ "$(nmcli radio wifi)" = "enabled" ] + function get_wifi_state() { + interface="$1" + + iwlist "$interface" power | sed 's/wlan0//' | awk '{$1=$1};1' | tr -s ' ' | grep "Current mode" | cut -d ':' -f 2 + } + if [ "$(get_wifi_state "wlan0")" = "on" ] then - nmcli radio wifi off + iwctl adapter phy0 set-property Powered off else - nmcli radio wifi on + iwctl adapter phy0 set-property Powered on fi ;; toggle-bluetooth) - if [ "$(nmcli radio wifi)" = "enabled" ] + if [ "$(bluetoothctl show | grep -i powered | tr '\t' ' ' | cut -f 3 -d ' ')" = "yes" ] then - nmcli radio wifi off + bluetoothctl power off else - nmcli radio wifi on + bluetoothctl power on fi ;; screenshot-all)