Lock screen from scratch

Install dependencies: #

i3lock
imagemagick # convert
scrot
dunst
libnotify # probably already installed with dunst, brave, nemo...

sudo pacman -S i3lock imagemagick scrot dunst

Save script in PATH #

Pick filename lockscreen

#!/bin/sh

rm -f /tmp/locked.png
rm -f /tmp/base.png

# If `imagemagick` is installed
[ -f /usr/bin/convert ] &&
scrot -m -z /tmp/base.png &&
pgrep -x dunst && notify-send "Locking computer..." &&
convert /tmp/base.png -blur 0x8 /tmp/locked.png

i3lock -e -f -c 000000 -i /tmp/locked.png

Make it executable: chmod +x lockscreen

Published