blob: 828c06ace3c695a9b29cc478141932bac9a0abd9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env bash
cur=""
function output {
exec echo '<action=`bluetooth-select.sh` button=1>'"$1"'</action>'
}
if [ -d /sys/class/bluetooth ] ; then
bluetoothctl -- info | while read line ; do
key=${line%%: *}
value=${line//*: }
if [ "$key" == "Name" ] ; then
cur="$value"
fi
if [ "$key" == "Connected" -a "$value" == "yes" ] ; then
output "<fc=#4287f5></fc> <fc=#a0a0a0><fn=3>$cur</fn></fc> "
fi
done
fi
output "<fc=#404040></fc> "
|