flake/users/guanranwang/home-manager/modules/wm/components/swayidle.nix
2023-11-15 20:55:27 +08:00

36 lines
781 B
Nix

{pkgs, ...}: {
imports = [
./swaylock.nix
];
services = {
swayidle = {
enable = true;
timeouts = [
{
timeout = 900;
command = "swaylock";
} # lock screen
{
timeout = 905;
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";
} # turn off screen
{
timeout = 1200;
command = ''systemctl suspend'';
} # suspend
];
events = [
{
event = "lock";
command = "swaylock";
} # loginctl lock-session
{
event = "before-sleep";
command = "swaylock";
} # systemctl syspend
];
};
};
}