2021-05-30 19:10:28 +00:00
|
|
|
{
|
2023-01-28 20:49:10 +00:00
|
|
|
pkgs,
|
|
|
|
psCfg,
|
|
|
|
...
|
|
|
|
}: {
|
2021-05-30 19:10:28 +00:00
|
|
|
Unit = {
|
|
|
|
Description = "Idle manager for Wayland";
|
2023-01-28 20:49:10 +00:00
|
|
|
Documentation = ["man:swayidle(1)"];
|
|
|
|
BindsTo = ["graphical-session.target"];
|
|
|
|
Wants = ["graphical-session-pre.target"];
|
|
|
|
After = ["graphical-session-pre.target"];
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
Service = {
|
|
|
|
Type = "simple";
|
2022-10-01 21:12:48 +00:00
|
|
|
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swaylock-bg}/bin:${pkgs.swayidle}/bin";
|
2023-01-28 20:49:10 +00:00
|
|
|
ExecStart =
|
|
|
|
'' ${pkgs.swayidle}/bin/swayidle -w \
|
|
|
|
after-resume 'swaymsg "output * dpms on"' \
|
|
|
|
after-resume '${pkgs.brightnessctl}/bin/brightnessctl -d gmux_backlight set 60%' \
|
|
|
|
before-sleep 'swaylock-bg' ''
|
|
|
|
+ (
|
|
|
|
if psCfg.paranoia.enable
|
|
|
|
then '' \
|
|
|
|
timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
|
|
|
timeout 150 'systemctl hibernate'
|
|
|
|
''
|
|
|
|
else '' \
|
|
|
|
timeout 600 'swaylock-bg' \
|
|
|
|
timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
|
|
|
|
''
|
|
|
|
);
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
Install = {
|
2023-01-28 20:49:10 +00:00
|
|
|
WantedBy = ["sway-session.target"];
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
}
|