aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/status/bluetooth-status
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/.local/scripts/status/bluetooth-status')
-rwxr-xr-xScripts/.local/scripts/status/bluetooth-status26
1 files changed, 17 insertions, 9 deletions
diff --git a/Scripts/.local/scripts/status/bluetooth-status b/Scripts/.local/scripts/status/bluetooth-status
index 35c550a..a84ede3 100755
--- a/Scripts/.local/scripts/status/bluetooth-status
+++ b/Scripts/.local/scripts/status/bluetooth-status
@@ -1,15 +1,23 @@
#!/usr/bin/env sh
-name=$(bluetoothctl info | grep "Alias" | sed 's/.*Alias: //')
-battery=$(bluetoothctl info | grep "Battery Percentage" | sed 's/.*(//;s/)//')
-if [ ! "$name" ]
+devices=$(bluetoothctl devices Connected | grep -oE '([0-9A-Fa-f:]{17})')
+
+if [ -z "$devices" ]
then
echo ""
else
- echo -n "" $name;
- if [ "$battery" ]
- then
- echo -n " ($battery%)"
- fi
- echo ""
+ acc=""
+
+ for mac in $devices
+ do
+ name=$(bluetoothctl info $mac | grep "Alias" | sed 's/.*Alias: //')
+ battery=$(bluetoothctl info $mac | grep "Battery Percentage" | sed 's/.*(//;s/)//')
+ acc="$acc $name"
+ if [ "$battery" ]
+ then
+ acc="$acc ($battery%)"
+ fi
+ done
+
+ echo "$acc"
fi