nemecle.wiki
sysadmin linux

triggering i3lock on sleep

en fr

Triggering i3lock when the computer goes to sleep

adapted from https://wiki.debian.org/ScreenLockingOnSleep

/etc/systemd/system/i3lock.service:

 1  [Unit]
 2  Description=i3lock
 3  Before=sleep.target
 4 
 5  [Service]
 6  User=nemecle
 7  Type=forking
 8  Environment=DISPLAY=:0
 9  ExecStart=/home/nemecle/.bin/scripts/lock.sh
10 
11  [Install]
12  WantedBy=sleep.target

lock.sh:

1  #!/usr/bin/env bash
2 
3  i3lock -i $HOME/Wallpaper_lock.png