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