27 lines
675 B
Nix
27 lines
675 B
Nix
|
{
|
||
|
pkgs,
|
||
|
psCfg,
|
||
|
...
|
||
|
}: {
|
||
|
Unit = {
|
||
|
Description = "Idle manager for Wayland";
|
||
|
Documentation = ["man:swayidle(1)"];
|
||
|
BindsTo = ["graphical-session.target"];
|
||
|
Wants = ["graphical-session-pre.target"];
|
||
|
After = ["graphical-session-pre.target"];
|
||
|
};
|
||
|
Service = {
|
||
|
Type = "simple";
|
||
|
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swayidle}/bin";
|
||
|
ExecStart = ''
|
||
|
swayidle -w \
|
||
|
before-sleep 'systemctl hibernate'
|
||
|
timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
||
|
timeout 150 'systemctl hibernate'
|
||
|
'';
|
||
|
};
|
||
|
Install = {
|
||
|
WantedBy = ["sway-session.target"];
|
||
|
};
|
||
|
}
|