flake/users/guanranwang/home-manager/applications/swayidle/default.nix
2023-11-29 17:56:30 +08:00

36 lines
778 B
Nix

{pkgs, ...}: {
imports = [
../swaylock
];
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
];
};
};
}