aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/systemd/user/swayidle.service
blob: dc84fe5a643cb953e1e7a384944f08cfec23a789 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[Unit]
Description=Idle manager for Wayland (lock + DPMS)
PartOf=graphical-session.target
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY

[Service]
Type=simple
# `before-sleep` deliberately only pauses media -- it does not lock.
# sway pauses its idle counter during suspend and resets on the first
# input event after resume, so the existing `timeout 300` already
# gives a 5-minute grace post-wake without a separate mechanism. The
# `lock` action still handles explicit `loginctl lock-session`.
ExecStart=/usr/bin/swayidle -w \
    timeout 300 'swaylock -f -e -c 282828' \
    timeout 360 'swaymsg "output * power off"' \
        resume  'swaymsg "output * power on"' \
    before-sleep 'playerctl -a pause' \
    lock         'swaylock -f -e -c 282828'
Restart=on-failure
RestartSec=2s

[Install]
WantedBy=sway-session.target