2022-08-14 15:10:30 +00:00
|
|
|
{ pkgs, psCfg, ... }:
|
2021-05-30 19:10:28 +00:00
|
|
|
{
|
|
|
|
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";
|
2022-01-12 16:39:16 +00:00
|
|
|
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
|
2022-08-23 23:20:39 +00:00
|
|
|
ExecStart =
|
|
|
|
if psCfg.paranoia.enable then ''
|
|
|
|
${pkgs.swayidle}/bin/swayidle -w \
|
|
|
|
timeout 120 'swaymsg "output * dpms off"' \
|
|
|
|
timeout 150 'systemctl hibernate' \
|
|
|
|
'' else ''
|
|
|
|
${pkgs.swayidle}/bin/swayidle -w \
|
|
|
|
timeout 600 'swaylock-bg' \
|
|
|
|
timeout 900 'swaymsg "output * dpms off"' \
|
|
|
|
resume 'swaymsg "output * dpms on"' \
|
|
|
|
before-sleep 'swaylock-bg'
|
|
|
|
'';
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
Install = {
|
|
|
|
WantedBy = [ "sway-session.target" ];
|
|
|
|
};
|
|
|
|
}
|