dots/.bin/toggle-bt-device

12 lines
235 B
Plaintext
Raw Normal View History

2021-12-31 16:04:23 +01:00
#!/usr/bin/env bash
status="$(bluetoothctl info "$1" | grep Connected | cut -f 2 -d ':' | cut -f 2 -d ' ')"
if [ "$status" == "no" ]
then
bluetoothctl connect "$1"
elif [ "$status" == "yes" ]
then
bluetoothctl disconnect "$1"
fi