#!/usr/bin/env bash # Get connected devices bt_connected=$(bluetoothctl devices | while read -r line; do mac=$(echo "$line" | awk '{print $2}') state=$(bluetoothctl info "$mac" | grep "Connected" | awk '{print $2}') if [ "$state" = "yes" ]; then name=$(echo "$line" | cut -d' ' -f3-) echo "$name" fi done) # Main icon for Waybar if [ -n "$bt_connected" ]; then echo "" else echo "" fi # Tooltip: connected device names echo "$bt_connected"