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