diff --git a/modules/home/hyprland.nix b/modules/home/hyprland.nix index ca36114..e40c8e8 100644 --- a/modules/home/hyprland.nix +++ b/modules/home/hyprland.nix @@ -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"