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

37 lines
781 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-08 11:59:42 +00:00
} # lock screen
2023-11-05 12:50:08 +00:00
{
timeout = 905;
2023-11-08 11:59:42 +00:00
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";
2023-11-05 12:50:08 +00:00
} # turn off screen
2023-11-08 11:59:42 +00:00
{
timeout = 1200;
command = ''systemctl suspend'';
} # suspend
2023-11-05 12:50:08 +00:00
];
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
];
};
};
}