dotfiles/.config/i3/screenlocker.sh

63 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# script for locking my screen on Arch using i3lock
# x1phosura
# thanks to http://www.michaelabrahamsen.com/posts/custom-lockscreen-i3lock/
# set icon and temporary photo location
icon="$HOME/.config/i3/icon.png"
tmpbg='/tmp/screenshot-temp.png'
# cleans up if screenshot already exists because scrot won't overwrite
rm -f $tmpbg
# takes a screenshot of the current screen (relies on 'scrot' package)
scrot "$tmpbg"
# blur the screenshot by resizing and scaling back up (relies on 'imagemagick')
convert "$tmpbg" -filter Gaussian -thumbnail 8% -sample 1250% "$tmpbg"
# overlay the icon onto the temporary screenshot
convert "$tmpbg" "$icon" -gravity center -composite "$tmpbg"
# thank you to https://github.com/PandorasFox/i3lock-color/blob/master/lock.sh
# colors for i3lock-color
B='#00000000' # blank or 'nothing'
D='#aaaaaacc' # default
W='#dd0000ff' # wrong red
V='#22bb88ff' # verifying
# lock the screen with the blurred picture AND lock icon settings
i3lock \
--insidever-color=$V \
--ringver-color=$V \
\
--insidewrong-color=$W \
--ringwrong-color=$W \
\
--inside-color=$B \
--ring-color=$D \
--line-color=$B \
--separator-color=$D \
\
--time-color=$B \
--date-color=$B \
\
--verif-color=$B \
--wrong-color=$B \
--keyhl-color='4466ccff' \
--bshl-color='000000ff' \
\
--screen 1 \
--indicator \
--ind-pos="x+1280:h-710" \
--verif-align 1 \
--wrong-align 1 \
--radius=100 \
--ring-width=4 \
-i "$tmpbg"
# --image="$tmpbg"