Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions bin/omarchy-headphone-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Shows headphone icon with battery level if bluetooth audio device is the active sink

# Get the active audio sink (marked with *)
ACTIVE_SINK=$(wpctl status 2>/dev/null | sed -n '/Audio/,/Video/p' | grep -E "^\s*│\s+\*" | head -1)

if echo "$ACTIVE_SINK" | grep -qiE "WH-|WF-|airpods|buds|headphone|headset|earbuds|bose|jabra|beats|galaxy|sony|xm[0-9]"; then
# Get battery percentage from upower for headset devices
BATTERY=""
for device in $(upower -e 2>/dev/null | grep headset); do
PERCENTAGE=$(upower -i "$device" 2>/dev/null | grep -oP 'percentage:\s+\K\d+')
if [ -n "$PERCENTAGE" ]; then
BATTERY="$PERCENTAGE%"
break
fi
done

if [ -n "$BATTERY" ]; then
echo "󰋋 <span font_size='10pt'>$BATTERY</span>"
else
echo "󰋋"
fi
fi
7 changes: 7 additions & 0 deletions config/waybar/config.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"modules-center": ["clock", "custom/update", "custom/screenrecording-indicator"],
"modules-right": [
"group/tray-expander",
"custom/headphone",
"bluetooth",
"network",
"pulseaudio",
Expand Down Expand Up @@ -106,6 +107,12 @@
"tooltip-format": "Devices connected: {num_connections}",
"on-click": "omarchy-launch-bluetooth"
},
"custom/headphone": {
"exec": "omarchy-headphone-status",
"interval": 3,
"format": "{}",
"tooltip-format": "Headphones connected"
},
"pulseaudio": {
"format": "{icon}",
"on-click": "omarchy-launch-or-focus-tui wiremix",
Expand Down
4 changes: 4 additions & 0 deletions config/waybar/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
margin-right: 16px;
}

#custom-headphone {
margin-right: 12px;
}

#bluetooth {
margin-right: 17px;
}
Expand Down