Files
nixos/Droidnix/generated/.config/waybar/scripts/bluetooth-status.sh
T
2026-03-31 17:18:49 +00:00

19 lines
486 B
Bash

#!/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"