[Unit] Description=Idle manager for Wayland (dim + lock + DPMS) PartOf=graphical-session.target After=graphical-session.target ConditionEnvironment=WAYLAND_DISPLAY [Service] Type=simple ExecStart=%h/.nix-profile/bin/swayidle -w \ timeout 300 'brightnessctl -s set 10% || true' \ resume 'brightnessctl -r || true' \ timeout 330 'pgrep -x swaylock >/dev/null || swaylock -f -e -c 000000' \ timeout 360 'swaymsg "output * power off"' \ resume '%h/.config/sway/display-wake.sh' \ timeout 1800 '%h/.local/bin/on-battery-suspend' \ before-sleep 'playerctl -a pause; pgrep -x swaylock >/dev/null || swaylock -f -e -c 000000' \ lock 'pgrep -x swaylock >/dev/null || swaylock -f -e -c 000000' Restart=on-failure RestartSec=2s [Install] WantedBy=sway-session.target