blob: 95958f91d1d9c60d17b5765cad7b2562950a5fb9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/bin/sh
# 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
|