Extend bluetooth-status to present the status of multiple devices
This commit is contained in:
@@ -1,15 +1,23 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
name=$(bluetoothctl info | grep "Alias" | sed 's/.*Alias: //')
|
devices=$(bluetoothctl devices Connected | grep -oE '([0-9A-Fa-f:]{17})')
|
||||||
battery=$(bluetoothctl info | grep "Battery Percentage" | sed 's/.*(//;s/)//')
|
|
||||||
if [ ! "$name" ]
|
if [ -z "$devices" ]
|
||||||
then
|
then
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo -n "" $name;
|
acc=""
|
||||||
if [ "$battery" ]
|
|
||||||
then
|
for mac in $devices
|
||||||
echo -n " ($battery%)"
|
do
|
||||||
fi
|
name=$(bluetoothctl info $mac | grep "Alias" | sed 's/.*Alias: //')
|
||||||
echo ""
|
battery=$(bluetoothctl info $mac | grep "Battery Percentage" | sed 's/.*(//;s/)//')
|
||||||
|
acc="$acc $name"
|
||||||
|
if [ "$battery" ]
|
||||||
|
then
|
||||||
|
acc="$acc ($battery%)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$acc"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user