dotfiles/dot_bin/executable_togglebt

15 lines
304 B
Bash

#! /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"