Last active
March 23, 2022 09:18
-
-
Save simonfontana/180f36c69a3d708e88bea605a1225b2f to your computer and use it in GitHub Desktop.
Lock screen after suspend with i3lock and systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file /etc/systemd/system/wakelock.service | |
[Unit] | |
Description=Lock the screen on resume from suspend | |
Before=sleep.target suspend.target | |
[Service] | |
User=%i | |
Type=forking | |
Environment=DISPLAY=":1" | |
ExecStart=/usr/bin/i3lock --color='#111111' | |
[Install] | |
WantedBy=sleep.target suspend.target | |
# Note that my DISPLAY is set to :1. You can verifiy what display you're using with `echo $DISPLAY`. | |
# You can of course change _ExecStart_ to whatever lock service you prefer. | |
# Save the file, then enable and reload systemd: | |
# `sudo systemctl enable wakelock@$(whoami).service && sudo systemctl daemon-reload` | |
# Verify that the service is loaded (it won't become active until you suspend): | |
# `systemctl status wakelock@$(whoami).service` | |
# Reference: [Lock screen after suspend with i3lock and systemd](https://gist.github.com/victorhaggqvist/603125bbc0f61a787d89) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment