home/swayidle: fix not suspending

This commit is contained in:
Guanran Wang 2024-08-30 09:07:53 +08:00
parent 5852b1cabd
commit 22dbe7b96b
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF

View file

@ -9,33 +9,23 @@
../swaylock ../swaylock
]; ];
services.swayidle = services.swayidle = {
let enable = true;
lock = lib.getExe config.programs.swaylock.package; timeouts = [
brightness = lib.getExe pkgs.brightnessctl; {
in timeout = 60 * 10;
{ command = "/run/current-system/sw/bin/systemctl suspend";
enable = true; }
timeouts = [ ];
{ events = [
timeout = 60 * 9; {
command = "${brightness} -s set 20%"; event = "lock";
resumeCommand = "${brightness} -r"; command = lib.getExe config.programs.swaylock.package;
} }
{ {
timeout = 60 * 10; event = "before-sleep";
command = "systemctl suspend"; command = "/run/current-system/systemd/bin/loginctl lock-session";
} }
]; ];
events = [ };
{
event = "lock";
command = lock;
}
{
event = "before-sleep";
command = lock;
}
];
};
} }