systemd and sleep

current enable sleep before lock is

vi /etc/systemd/system/suspend.service

[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/xscreensaver-command -lock

[Install]
WantedBy=sleep.target

then, enable it

systemctl enable suspend

relerence: https://wiki.archlinux.org/index.php/Power_management

Comments