Files
2026-04-22 12:23:49 +02:00

19 lines
591 B
Bash
Executable File

#!/usr/bin/env bash
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
bt_connected=""
while read -r _ mac name_rest; do
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
bt_connected+="$name_rest\n"
fi
done < <(bluetoothctl devices)
# icon
if [ -n "$bt_connected" ]; then
icon=""
tooltip=$(printf "%b" "$bt_connected")
else
icon=""
tooltip="No devices connected"
fi
# ALWAYS produce valid JSON
printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"