feat(waybar): mic/audio clicks

This commit is contained in:
Barrett Ruth 2026-02-20 21:48:22 -05:00
parent 30dc3f20ea
commit 44569e115b
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 20 additions and 1 deletions

View file

@ -192,4 +192,7 @@ windowrule = match:class ^(xdg-desktop-portal-kde)$, size monitor_w * 0.5 monito
windowrule = match:class ^(xdg-desktop-portal-hyprland)$, float on windowrule = match:class ^(xdg-desktop-portal-hyprland)$, float on
windowrule = match:class ^(xdg-desktop-portal-hyprland)$, size monitor_w * 0.5 monitor_h * 0.6 windowrule = match:class ^(xdg-desktop-portal-hyprland)$, size monitor_w * 0.5 monitor_h * 0.6
windowrule = match:class ^(org.pulseaudio.pavucontrol)$, float on
windowrule = match:class ^(org.pulseaudio.pavucontrol)$, size 600 450
windowrule = match:class ^([Ss]ioyek)$, tile on windowrule = match:class ^([Ss]ioyek)$, tile on

View file

@ -92,6 +92,7 @@ in
glib.bin glib.bin
gsettings-desktop-schemas gsettings-desktop-schemas
(python3.withPackages (ps: [ ps.pillow ])) (python3.withPackages (ps: [ ps.pillow ]))
pavucontrol
]; ];
programs.waybar = { programs.waybar = {
@ -110,6 +111,7 @@ in
"tray" "tray"
"custom/keyboard" "custom/keyboard"
"privacy" "privacy"
"custom/mic"
"pulseaudio" "pulseaudio"
"network" "network"
"battery" "battery"
@ -153,6 +155,18 @@ in
rewrite = { }; rewrite = { };
}; };
"custom/mic" = {
exec = ''sh -c 'out=$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@); vol=$(echo "$out" | awk "{printf \"%.0f\", \$2 * 100}"); if echo "$out" | grep -q MUTED; then echo "{\"text\":\"󰍭\",\"tooltip\":\"Mic: muted\",\"class\":\"muted\"}"; else echo "{\"text\":\"󰍬\",\"tooltip\":\"Mic: ''${vol}%\",\"class\":\"active\"}"; fi' '';
return-type = "json";
interval = 1;
signal = 2;
on-click = "pgrep pavucontrol && pkill pavucontrol || pavucontrol --tab=4";
on-click-right = "ctl audio in";
on-click-middle = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%+ --limit 1.0";
on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-";
};
pulseaudio = { pulseaudio = {
format = "{icon}"; format = "{icon}";
format-muted = "󰖁"; format-muted = "󰖁";
@ -166,8 +180,9 @@ in
signal = 1; signal = 1;
tooltip = true; tooltip = true;
tooltip-format = "Volume: {volume}%\nOutput: {desc}"; tooltip-format = "Volume: {volume}%\nOutput: {desc}";
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; on-click = "pgrep pavucontrol && pkill pavucontrol || pavucontrol --tab=3";
on-click-right = "ctl audio out"; on-click-right = "ctl audio out";
on-click-middle = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ --limit 1.0"; on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ --limit 1.0";
on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
}; };
@ -256,6 +271,7 @@ in
#custom-keyboard, #custom-keyboard,
#privacy, #privacy,
#tray, #tray,
#custom-mic,
#pulseaudio, #pulseaudio,
#network, #network,
#battery, #battery,