fix(waybar): mic icon centering and change to event-driven updating

This commit is contained in:
2026-02-09 14:18:04 +00:00
parent 2fce7ad031
commit 5cfcb8a394
3 changed files with 26 additions and 12 deletions

View File

@@ -82,9 +82,10 @@
}, },
"custom/micmute": { "custom/micmute": {
"exec": "bash -c 'wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep -q MUTED && echo \"\" || echo \"\"'", "exec": "~/.config/waybar/scripts/micmute.sh",
"interval": 1, "interval": 0,
"tooltip": true, "tooltip": true,
"min-length": 2,
"on-click": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" "on-click": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
} }
} }

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
print_icon() {
if wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep -q MUTED; then
echo ""
else
echo ""
fi
}
# Print once on startup
print_icon
# Subscribe to PipeWire events
wpctl subscribe @DEFAULT_AUDIO_SOURCE@ | while read -r _; do
print_icon
done

View File

@@ -5,7 +5,7 @@
/* --- Global Styles --- */ /* --- Global Styles --- */
* { * {
font-family: 'SF Pro Text', 'Inter', 'Segoe UI, NotoSans Nerd Font', sans-serif; font-family: "JetBrainsMono Nerd Font Propo";
font-size: 14px; font-size: 14px;
min-height: 25px; min-height: 25px;
padding-right: 0px; padding-right: 0px;
@@ -89,7 +89,8 @@
#custom-power:hover, #custom-power:hover,
#pulseaudio:hover, #pulseaudio:hover,
#battery:hover, #battery:hover,
#tray:hover { #tray:hover,
#custom-micmute:hover {
background-color: @Buttonshover; background-color: @Buttonshover;
} }
@@ -107,17 +108,11 @@
background-color: @Buttons; background-color: @Buttons;
color: @Text; color: @Text;
border-radius: 10px; border-radius: 10px;
padding: 0.5rem; padding: 0.7rem;
margin: 5px; margin: 0.35rem;
transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
} }
#pulseaudio {
background-color: @Buttons;
color: @Text;
padding-right: 1rem;
}
#battery { #battery {
color: @Text; color: @Text;