1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
config,
...
}:
{
config = {
services.swayidle = {
enable = true;
systemdTarget = "sway-session.target";
timeouts = [
{
timeout = 90;
command = "${config.programs.swaylock.package}/bin/swaylock -f";
}
{
timeout = 95;
command = "${config.wayland.windowManager.sway.package}/bin/swaymsg 'output * power off'";
resumeCommand = "${config.wayland.windowManager.sway.package}/bin/swaymsg 'output * power on'";
}
];
events = [
{
event = "before-sleep";
# Invoke swaylock instantaneously and without animations that inhibit sleep.
command = "${config.programs.swaylock.package}/bin/swaylock -f --grace 0 --fade-in 0";
}
];
};
};
}