niri: Power off monitors via DPMS

This commit is contained in:
Mikael 2024-09-16 20:25:01 +02:00
parent 36da49ac01
commit 64c7fae974
Signed by: mikael
SSH key fingerprint: SHA256:21QyD2Meiot7jOUVitIR5YkGB/XuXdCvLW1hE6dsri0

View file

@ -8,29 +8,13 @@ let
fuzzel = lib.getExe config.programs.fuzzel.package;
kitty = lib.getExe config.programs.kitty.package;
loginctl = osConfig.systemd.package + /bin/loginctl;
niri = lib.getExe config.programs.niri.package;
playerctl = config.services.playerctld.package + /bin/playerctl;
swaylock = lib.getExe config.programs.swaylock.package;
systemctl = osConfig.systemd.package + /bin/systemctl;
wpctl = osConfig.services.pipewire.wireplumber.package + /bin/wpctl;
xdg-open = pkgs.xdg-utils + /bin/xdg-open;
niri-each-output = let
pkg = pkgs.writeShellApplication {
name = "niri-each-output";
runtimeInputs = [
config.programs.niri.package
pkgs.findutils
pkgs.jq
];
text = ''
niri msg --json outputs \
| jq --raw-output0 '. | keys | .[]' \
| xargs -0 I {} -- niri msg output {} "$1"
'';
};
in lib.getExe pkg;
askpass = let
pkg = pkgs.writeShellApplication {
name = "fuzzel-askpass";
@ -338,8 +322,7 @@ in lib.mkIf (osConfig.hardware.graphics.enable or false) {
}
{
timeout = 270;
command = "${niri-each-output} off";
resumeCommand = "${niri-each-output} on";
command = "${niri} msg action power-off-monitors";
}
];
};