dotfiles/.config/eww/scripts/toggle-bluetooth-state.sh

13 lines
303 B
Bash
Raw Normal View History

2024-11-19 09:37:19 +01:00
#!/bin/bash
if [[ $(bluetoothctl show | grep Powered: | cut -f 2 -d ' ') == "no" ]]; then
if [[ ! $(bluetoothctl power on) ]]; then
rfkill block bluetooth
rfkill unblock bluetooth
fi
else
bluetoothctl power off
fi
eww update bluetooth="$(~/.config/eww/scripts/get-bluetooth.sh once)"