flake/users/guanranwang/home-manager/resources/wm/components/swayidle.nix

32 lines
668 B
Nix

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