dotfiles/dot_bin/executable_togglebt

15 lines
304 B
Plaintext
Raw Normal View History

2021-02-15 20:53:16 -05:00
#! /bin/bash
## toggle the bluetooth power state and notify
## lazy awk usage :)
btstate="$(bluetoothctl show | grep "Powered: " | awk '{print $2}')"
btaction="off"
if [[ $btstate == "no" ]]; then
btaction="on"
fi
bluetoothctl power "$btaction" > /dev/null
notify-send "bluetooth powered $btaction"