Bash script:
Code: Select all
#!/bin/bash
# Get macadress of headphone
btmac=$(bluetoothctl devices | grep "^Device E7" | awk '{print $2}')
echo "$btmac"
# Is device paired
btpair=$(echo "$btmac" | while read uuid; do bluetoothctl info $uuid; done | grep "Paired" | awk -F": " '{print "Paired: "$2}')
echo "$btpair"
# Is device connected
btconn=$(echo "$btmac" | while read uuid; do bluetoothctl info $uuid; done | grep "Connected" | awk -F": " '{print "Connected: "$2}')
echo "$btconn"
# Battery status
btbatt=$(bluetooth_battery "$btmac" | awk '{print $1": "$6}')
echo "$btbatt"
btbattbar=$(echo "$btbatt" | awk '{print $2}'); btbattbar=${btbattbar:0:-1}
echo "$btbattbar"
Terminal output:
Code: Select all
E7:D6:AA:76:A3:10
Paired: yes
Connected: yes
Battery: 100%
100
When i start it inside conky the battery stats are not shown... (last 2 lines)