mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 09:36:14 +01:00
Fix power settings for bluetooth and wifi in auxmenu
Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
parent
01421acf78
commit
8ebc3a65ba
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue