dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

commit 25b85fe0b2691694e2fe82e18d151e26164b692a
parent ff55fb6cccd25eae4644ad6bcdba51ec1228c717
Author: Chris <chris@echoz.io>
Date:   Sun, 22 Feb 2026 21:48:46 +0100

feat: add unmuted mic indicator with eww

Diffstat:
Amodules/eww/default.nix | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/hypr/hyprland.nix | 5+++--
2 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/modules/eww/default.nix b/modules/eww/default.nix @@ -0,0 +1,94 @@ +{ + lib, + pkgs, + + user, + style, + ... +}: +let + yuck = pkgs.writeTextDir "/eww.yuck" '' + (defwidget microphone-indicator [] + (box + :orientation "v" + :halign "center" + :valign "center" + :visible {!microphone-muted} + :active "false" + (label :xalign 0.5 :justify "center" :text ""))) + + (defwindow microphone-indicator + :monitor 0 + :stacking "overlay" + :focusable "none" + :namespace "microphone-indicator" + :geometry (geometry :y "10px" :width "0px" :height "0px" :anchor "bottom center") + (microphone-indicator)) + + (deflisten microphone-muted + :initial "false" + "${pkgs.writeShellScript "monitor-microphone-muted" '' + ${lib.getExe pkgs.pamixer} --default-source --get-mute + ${lib.getExe' pkgs.pulseaudio "pactl"} --format json subscribe \ + | ${lib.getExe pkgs.jq} --unbuffered -cr 'select(.event == "change" and .on == "source") | "."' \ + | xargs -L1 ${lib.getExe pkgs.pamixer} --default-source --get-mute + ''}") + ''; + + scss = + let + s = toString; + fg = with style.colors.fg; "rgba(${s r},${s g},${s b},0.2)"; + in + pkgs.writeTextDir "/eww.scss" '' + .microphone-indicator { + color: ${fg}; + font-size: 80px; + min-width: 60px; + + &.background { + background: transparent; + } + } + ''; + + configDir = pkgs.symlinkJoin { + name = "eww-config"; + paths = [ + yuck + scss + ]; + }; +in +{ + home-manager.users.${user} = + { config, ... }: + { + wayland.windowManager.hyprland.settings.layerrule = [ + "blur on, ignore_alpha 0, no_anim on, match:namespace microphone-indicator" + ]; + + programs.eww = { + inherit configDir; + enable = true; + }; + + systemd.user.services.eww = { + Unit = { + PartOf = [ config.wayland.systemd.target ]; + After = [ config.wayland.systemd.target ]; + ConditionEnvironment = "WAYLAND_DISPLAY"; + X-Restart-Triggers = [ "${config.programs.eww.configDir}" ]; + }; + + Service = { + ExecStart = "${lib.getExe config.programs.eww.package} daemon --no-daemonize"; + ExecStartPost = "${lib.getExe config.programs.eww.package} open microphone-indicator"; + KillMode = "mixed"; + Restart = "on-failure"; + }; + + Install.WantedBy = [ config.wayland.systemd.target ]; + }; + }; +} diff --git a/modules/hypr/hyprland.nix b/modules/hypr/hyprland.nix @@ -1,5 +1,6 @@ { lib, + pkgs, style, user, @@ -160,8 +161,8 @@ "$mod, mouse:273, resizewindow" ]; - bindni = [ ", Alt_L, sendkeystate, , Alt_L, down, class:discord" ]; - bindnir = [ ", Alt_L, sendkeystate, , Alt_L, up, class:discord" ]; + bindpunti = [ ", Alt_L, exec, ${lib.getExe pkgs.pamixer} --default-source --unmute" ]; + bindpuntir = [ ", Alt_L, exec, ${lib.getExe pkgs.pamixer} --default-source --mute" ]; windowrule = [ "no_blur on, match:xwayland 1"