#/etc/systemd/system/ [Unit] Description=Turning i3lock on before sleep Before=sleep.target [Service] User=trotfunky Type=forking Environment=DISPLAY=:0 ExecStart=/home/trotfunky/lockscreen.sh ExecStartPost=sleep 1 [Install] WantedBy=sleep.target