reNixos/hand7s/services/swayidle.nix
s0me1newithhand7s e897fb4e87
hand7s: migrate from ${pkgs}/bin/ paths to ${lib.getExe pkgs}
Signed-off-by: s0me1newithhand7s <117505144+s0me1newithhand7s@users.noreply.github.com>
2025-06-13 13:06:24 +03:00

50 lines
1.3 KiB
Nix

{
config,
pkgs,
lib,
...
}: {
services = {
swayidle = {
enable = lib.mkIf (
config.home.gui.sessionType == "Sway"
)
true;
events = [
{
event = "lock";
command = "${lib.getExe pkgs.swaylock}";
}
{
event = "before-sleep";
command = "${lib.getExe' pkgs.sway "swaymsg"} 'output * power off'";
}
{
event = "after-resume";
command = "${lib.getExe' pkgs.sway "swaymsg"} 'output * power on'";
}
];
timeouts = [
{
timeout = 300;
command = "${libgetExe pkgs.brightnessctl} -s set 10";
resumeCommand = "${libgetExe pkgs.brightnessctl} -r";
}
{
timeout = 600;
command = "${lib.getExe pkgs.swaylock}";
}
{
timeout = 900;
command = "${lib.getExe' pkgs.systemd "systemctl"} suspend";
}
];
};
};
}