fix(hyprland): mic mute via wpctl -- swayosd 0.2.1 input-mute is a no-op

swayosd-client --input-volume mute-toggle draws the OSD but never flips the
default source's mute (its output-mute path works; input does not). Confirmed
on hardware: wpctl set-mute @DEFAULT_SOURCE@ toggle flips the state, swayosd
does not. Do the real toggle with wpctl and keep an OSD via swayosd's
--custom-icon/--custom-message.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-06-14 12:11:20 +01:00
parent 2c8e0b47f9
commit 66f58fa228

View File

@@ -1,13 +1,31 @@
# Hyprland — fully driven by config.nomarchy.theme (theme-state.json).
# Gaps, borders and colors are baked from the JSON at eval time; theme
# changes arrive via `home-manager switch`.
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
let
t = config.nomarchy.theme;
c = t.colors;
inherit (config.nomarchy.lib) rgb rgba;
# swayosd 0.2.1's `--input-volume mute-toggle` draws the OSD but never
# flips the source mute (verified on hardware: wpctl toggles the state,
# swayosd's input-mute path is a no-op — unlike its working output-mute
# path). Do the real toggle with wpctl, then show an OSD reflecting the
# resulting state via swayosd's --custom-icon/--custom-message.
micMute = pkgs.writeShellScript "nomarchy-mic-mute" ''
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_SOURCE@ toggle
if ${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_SOURCE@ | grep -q MUTED; then
${pkgs.swayosd}/bin/swayosd-client \
--custom-icon microphone-sensitivity-muted-symbolic \
--custom-message "Microphone muted"
else
${pkgs.swayosd}/bin/swayosd-client \
--custom-icon microphone-sensitivity-high-symbolic \
--custom-message "Microphone unmuted"
fi
'';
# SUPER+1..9 / SUPER+SHIFT+1..9 workspace binds, generated.
workspaceBinds = builtins.concatLists (builtins.genList
(i:
@@ -150,7 +168,8 @@ in
bindl = [
", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle"
", XF86AudioMicMute, exec, swayosd-client --input-volume mute-toggle"
# swayosd's input mute-toggle is broken on 0.2.1 (see micMute above).
", XF86AudioMicMute, exec, ${micMute}"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPause, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"