[Unit]
Description=Lock screen when going to sleep or suspend.
Before=sleep.target
Before=suspend.target

[Service]
User=severin
Type=simple
Environment=DISPLAY=:0
ExecStart=/home/severin/.local/bin/screenlock
TimeoutSec=infinity
ExecStartPost=/sbin/sleep 1

[Install]
WantedBy=sleep.target
WantedBy=suspend.target