Skip to content

Instantly share code, notes, and snippets.

@txtyash
Last active August 27, 2022 16:43
Show Gist options
  • Save txtyash/2e405fb559c25682fa8730733c79adff to your computer and use it in GitHub Desktop.
Save txtyash/2e405fb559c25682fa8730733c79adff to your computer and use it in GitHub Desktop.
Lock screen on sleep/hibernate with slock. Place this file under /etc/systemd/system/slock.service
[Unit]
Description=Lock X session using slock for user %i
Before=sleep.target
[Service]
User=zim
Environment=DISPLAY=:0
ExecStartPre=/usr/bin/xset dpms force suspend
ExecStart=/usr/bin/slock
[Install]
WantedBy=suspend.target,hibernate.target
@txtyash
Copy link
Author

txtyash commented Aug 27, 2022

Don't forget to change the user name to your's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment