28 lines
735 B
Nix
28 lines
735 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.swaylock-bg}/bin:${pkgs.swayidle}/bin";
|
|
ExecStart = ''
|
|
swayidle -w \
|
|
after-resume 'swaymsg "output * dpms on"' \
|
|
before-sleep 'swaylock-bg' \
|
|
timeout 300 'swaylock-bg' \
|
|
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
|
|
'';
|
|
};
|
|
Install = {
|
|
WantedBy = ["sway-session.target"];
|
|
};
|
|
}
|