flake/users/guanranwang/home-manager/nixos/wm/swayidle.nix

33 lines
681 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;
command = "loginctl lock-session";
}
{
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
];
};
};
}