dotfiles/.config/waybar/bluetooth_toggle_power.sh

11 lines
231 B
Bash
Raw Normal View History

2023-09-26 17:12:28 +02: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