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

33 lines
668 B
Nix
Raw Normal View History

2023-11-05 12:50:08 +00:00
{pkgs, ...}: {
imports = [
./swaylock.nix
];
2023-11-05 12:50:08 +00:00
services = {
swayidle = {
2023-11-05 12:50:08 +00:00
enable = true;
timeouts = [
{
timeout = 900;
2023-11-07 10:16:47 +00:00
command = "swaylock";
2023-11-05 12:50:08 +00:00
}
{
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";
2023-11-05 12:50:08 +00:00
} # loginctl lock-session
{
event = "before-sleep";
command = "swaylock";
2023-11-05 12:50:08 +00:00
} # systemctl syspend
];
};
};
}