Fix power settings for bluetooth and wifi in auxmenu

Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
magic_rb 2023-11-18 13:45:11 +01:00
parent 01421acf78
commit 8ebc3a65ba
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E

View file

@ -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)