blob: 29ec6c6c6901165bc5553a4e70991374eff2ef6f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env dash
# Toggle Bluetooth power via bluetoothctl. Uses notify-send's synchronous
# hint so repeated toggles replace the previous notification instead of
# stacking.
set -eu
state=$(bluetoothctl show | awk '/Powered:/ {print $2}')
if [ "$state" = "yes" ]; then
bluetoothctl power off >/dev/null
notify-send -t 1500 -h string:x-canonical-private-synchronous:bt \
'Bluetooth' 'off'
else
bluetoothctl power on >/dev/null
notify-send -t 1500 -h string:x-canonical-private-synchronous:bt \
'Bluetooth' 'on'
fi
|