Files
nix-config/home/common/features/niri/niri.nix
T
WinterEkisha 3796bd26c6 feat: niri keybind
sway lock + sileneces lights and sounds
2026-11-15 16:55:34 -08:00

43 lines
1.0 KiB
Nix

{ config, pkgs, ... }:
let
lockNTurnOffScript = pkgs.writeShellApplication {
name = "lockNTurnOffScreen";
runtimeInputs = with pkgs; [
wireplumber # provides wpctl
swaylock
niri
];
text = ''
# Check if already muted so we don't accidentally unmute a manually muted system
WAS_MUTED=false
if wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q '\[MUTED\]'; then
WAS_MUTED=true
fi
# Mute audio and power off monitors
wpctl set-mute @DEFAULT_AUDIO_SINK@ 1
niri msg action power-off-monitors
# Run swaylock in the foreground (blocks until unlocked)
swaylock
# Restore mute state upon unlock
if [ "$WAS_MUTED" = false ]; then
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
fi
'';
};
in
{
xdg.configFile."niri/config.kdl".source = ./config.kdl;
# --- Niri-Extras ---
programs.fuzzel.enable = true;
xdg.mime.enable = true;
services.playerctld.enable = true;
home.packages = with pkgs; [
#mako
lockNTurnOffScript
];
}