From ac3c161fb5fc0df791d0a1bd28eb522e6540191f Mon Sep 17 00:00:00 2001 From: Shawn Yeager Date: Wed, 14 Jan 2026 10:37:57 -0600 Subject: [PATCH] Fix Bluetooth device showing bluez ID instead of friendly name For Bluetooth audio devices, the friendly name (e.g., "Shawn's AirPods Max") is stored on the Device entry in wpctl, not the Sink entry. The previous fix looked up object.id (the sink), which shows the raw bluez ID like "bluez_output.90:9C:4A:EE:01:1C". This fix looks up device.id first to get the friendly name from the Device entry, falling back to object.id for non-Bluetooth devices. Co-Authored-By: Claude Opus 4.5 --- bin/omarchy-cmd-audio-switch | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-cmd-audio-switch b/bin/omarchy-cmd-audio-switch index 299eeb19..8e1b7d60 100755 --- a/bin/omarchy-cmd-audio-switch +++ b/bin/omarchy-cmd-audio-switch @@ -28,8 +28,16 @@ next_sink_name=$(echo "$next_sink" | jq -r '.name') next_sink_description=$(echo "$next_sink" | jq -r '.description') if [ "$next_sink_description" = "(null)" ] || [ "$next_sink_description" = "null" ] || [ -z "$next_sink_description" ]; then - sink_id=$(echo "$next_sink" | jq -r '.properties."object.id"') - next_sink_description=$(wpctl status | grep -E "\s+\*?\s+${sink_id}\." | sed -E 's/^.*[0-9]+\.\s+//' | sed -E 's/\s+\[.*$//') + # For Bluetooth devices, the friendly name is on the Device entry (device.id), not the Sink entry (object.id) + device_id=$(echo "$next_sink" | jq -r '.properties."device.id"') + if [ "$device_id" != "null" ] && [ -n "$device_id" ]; then + next_sink_description=$(wpctl status | grep -E "^\s*│?\s+${device_id}\." | sed -E 's/^.*[0-9]+\.\s+//' | sed -E 's/\s+\[.*$//') + fi + # Fall back to object.id lookup if device.id didn't yield a result + if [ -z "$next_sink_description" ]; then + sink_id=$(echo "$next_sink" | jq -r '.properties."object.id"') + next_sink_description=$(wpctl status | grep -E "\s+\*?\s+${sink_id}\." | sed -E 's/^.*[0-9]+\.\s+//' | sed -E 's/\s+\[.*$//') + fi fi next_sink_volume=$(echo "$next_sink" | jq -r \