Regenerated

This commit is contained in:
2026-03-31 22:44:15 +02:00
parent 55368a6b01
commit 701f6cccc8
3 changed files with 316 additions and 310 deletions
@@ -1,19 +1,21 @@
#!/usr/bin/env bash
bt_connected=$(bluetoothctl devices | while read -r line; do
mac=$(echo "$line" | awk '{print $2}')
bt_connected=""
while read -r _ mac name_rest; do
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
echo "$line" | cut -d' ' -f3-
bt_connected+="$name_rest\n"
fi
done)
icon=""
tooltip=null
done < <(bluetoothctl devices)
# icon
if [ -n "$bt_connected" ]; then
icon=""
tooltip=$(echo "$bt_connected" | jq -R -s '.')
tooltip=$(printf "%b" "$bt_connected")
else
icon=""
tooltip="No devices connected"
fi
# Output JSON for Waybar
jq -n --arg text "$icon" --argjson tooltip "$tooltip" '{text: $text, tooltip: $tooltip}'
# ALWAYS produce valid JSON
printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"