diff options
Diffstat (limited to '.config')
-rw-r--r-- | .config/fish/functions/spk.fish | 3 | ||||
-rwxr-xr-x | .config/i3/connect-speakers.sh | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/.config/fish/functions/spk.fish b/.config/fish/functions/spk.fish new file mode 100644 index 00000000..91e5dd85 --- /dev/null +++ b/.config/fish/functions/spk.fish @@ -0,0 +1,3 @@ +function spk + ~/.config/i3/connect-speakers.sh +end 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" |