nixos_config/home/modules/services/swayidle.nix

36 lines
835 B
Nix
Raw Normal View History

2026-03-10 21:50:51 +01:00
{ pkgs, ... }:
2026-03-10 21:05:35 +01:00
let
2026-03-10 21:50:51 +01:00
commands = import ../../../lib/commands.nix { inherit pkgs; };
2026-03-10 21:05:35 +01:00
inherit (commands) notify lock display;
in
2026-03-10 18:54:37 +01:00
{
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 120;
command = "${notify} 'Locking in 5 seconds' -t 5000";
}
{
timeout = 125;
command = lock;
}
{
timeout = 125;
command = display "off";
resumeCommand = display "on";
}
{
timeout = 600;
command = "${pkgs.systemd}/bin/systemctl suspend";
}
2026-03-10 21:50:51 +01:00
];
events = {
before-sleep = "display off; systemctl --user stop libinput-gestures; ${lock}";
after-resume = "display on; systemctl --user start libinput-gestures";
lock = (display "off") + "; " + lock;
unlock = display "on";
};
2026-03-10 21:50:51 +01:00
};
}