Add screen dimming and switching off displays on idle

This commit is contained in:
JuliusFreudenberger 2026-06-27 17:11:20 +02:00
parent 81a4822e2d
commit b6909c162b

View file

@ -245,6 +245,8 @@ in {
}; };
services.swayidle = let services.swayidle = let
dimDuration = 15;
dimScreen = "${lib.getExe pkgs.chayang} -d ${toString dimDuration}";
swaylock = "${lib.getExe pkgs.swaylock} -f"; swaylock = "${lib.getExe pkgs.swaylock} -f";
switchOutput = "${pkgs.sway}/bin/swaymsg 'output * power'"; switchOutput = "${pkgs.sway}/bin/swaymsg 'output * power'";
in { in {
@ -255,8 +257,7 @@ in {
after-resume = "${switchOutput} on"; after-resume = "${switchOutput} on";
}; };
timeouts = [ timeouts = [
{ timeout = 300; command = "${switchOutput} off"; } { timeout = 300; command = "${dimScreen} && ${switchOutput} off && ${swaylock}"; resumeCommand = "${switchOutput} on"; }
{ timeout = 330; command = swaylock; }
]; ];
}; };