diff options
Diffstat (limited to '.config/i3/connect-speakers.sh')
-rwxr-xr-x | .config/i3/connect-speakers.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.config/i3/connect-speakers.sh b/.config/i3/connect-speakers.sh new file mode 100755 index 00000000..0bc1d2bc --- /dev/null +++ b/.config/i3/connect-speakers.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +MAC="7C:96:D2:6E:79:CA" + +powered() { + echo "show" | bluetoothctl | grep "Powered" | cut -d " " -f 2 +} + +connected() { + echo "info ${MAC}" | bluetoothctl | grep "Connected" | cut -d " " -f 2 +} + +echo "trust ${MAC}" | bluetoothctl +while [ $(connected) = no ] +do + sleep 1 + if [ $(powered) = yes ] && [ $(connected) = no ]; then + echo "connect ${MAC}" | bluetoothctl + sleep 5 + fi +done + +echo "Connected" |