Linux, plaintext & minimalism

Notice: This blog have moved to hunden.linuxkompis.se. Read more about it here: My blog have a new home and a new address.

January 8, 2019

Using i3lock with systemd-suspend

This is a remake of a few days old post [Commit: 83ac8455]. I shouldn't make posts when I'm that tired. :)

It took me a few tries before figuring this one out. But I eventually found the [the easy] solution in an old thread on the Arch Linux forums [Link].

I started out by creating the file /etc/systemd/system/i3lock.service with the following content:

Description=Lock screen before suspend



I then enabled the service with the command:

# systemctl enable i3lock.service

That’s it! And for those curious, this is what my i3lock.sh looks like:



# Take a screenshot for our background
scrot $img
# Pixelate the background
convert $img -scale 10% -scale 1000% $img
# Add the lock-icon
convert $img $icon -gravity center -composite $img
# Finally run i3lock itself
i3lock -u -i $img

It will now lock my screen before it goes to sleep, so it’s locked when it wakes up again.

Tags: i3 | i3lock | Systemd | Suspend


I don't have a commenting system simply because I haven't found a solution that I like. If you want to leave any feedback and/or have any questions, feel free to contact me either via e-mail, fediverse, XMPP or IRC (I'm Hund at freenode.net).