Blurry lock screen with i3lock
by Lorenz Leitner
This is a tutorial on how to get a lock screen like this:
Prerequisites
- Some Linux distribution
- i3lock
- scrot
- imagemagick
- An icon (examples)
To install the package prerequisites, depending on your Linux distribution you can use the package manager.
For example on Ubuntu based distros:
sudo apt-get install i3lock scrot imagemagick
The script
The major workload is done by this script:
#!/bin/bash
scrot /tmp/screen.png
convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png
[[ -f $HOME/Pictures/Icons/lock.png ]] && convert /tmp/screen.png $HOME/Pictures/Icons/lock.png -gravity center -composite -matte /tmp/screen.png
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop
i3lock -u -i /tmp/screen.png
Actual steps
-
Make sure you have the prerequisites, see above.
-
Copy this script to your home folder, call it lock.sh (for example).
curl http://lolei.github.io/blog/assets/post_files/lock.sh >> ~/lock.sh -
Add permissions so it can be executed
chmod +x ~/lock.sh -
Get an icon and save it somewhere. If you use a different folder or icon name you’ll have to change it in the script too.
mkdir -p ~/Pictures/Icons && curl https://i.imgur.com/qY1nKlP.png >> ~/Pictures/Icons/lock.png -
Now you can run the script.
~/lock.sh -
Create an alias to have a dedicated command for the script.
alias lock="~/lock.sh" -
You can also create a keyboard shortcut. Go to your keyboard settings, shortcuts, create a custom shortcut, as command enter the script name and location again.
~/lock.sh
And in case you don’t know, i3lock can be unlocked just by typing your
password when it is active and pressing Enter.
Finish
There you go, you have your own blurry lock screen.
If you think you’re funny like me (/s), use a hilarious icon, click here for the one I made.
How it looks on my Laptop with Arch Linux:
How it looks on my desktop PC with Elementary OS:
Sources
I found out about this script on Reddit.
The instructions I got from user /u/TotallyNotAnAlien.
Subscribe via RSS