os/modules/sway/swayidle.service.nix

22 lines
581 B
Nix

pkgs:
{
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";
ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \
timeout 150 'swaymsg "output * dpms off"' \
timeout 300 'systemctl hibernate' \
'';
};
Install = {
WantedBy = [ "sway-session.target" ];
};
}