-
Notifications
You must be signed in to change notification settings - Fork 0
/
i3lock.sh
executable file
·31 lines (28 loc) · 1.14 KB
/
i3lock.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
# source: https://www.reddit.com/r/unixporn/comments/3358vu/i3lock_unixpornworthy_lock_screen
scrot /tmp/screen.png
convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png
if [[ -f $HOME/.config/screen-lock.png ]]
then
# placement x/y
PX=0
PY=0
# lockscreen image info
R=$(file ~/.config/screen-lock.png | grep -o '[0-9]* x [0-9]*')
RX=$(echo $R | cut -d' ' -f 1)
RY=$(echo $R | cut -d' ' -f 3)
SR=$(xrandr --query | grep ' connected' | cut -f3 -d' ')
for RES in $SR
do
# monitor position/offset
SRX=$(echo $RES | cut -d'x' -f 1) # x pos
SRY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 1) # y pos
SROX=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 2) # x offset
SROY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 3) # y offset
PX=$(($SROX + $SRX/2 - $RX/2))
PY=$(($SROY + $SRY/2 - $RY/2))
convert /tmp/screen.png $HOME/.config/screen-lock.png -geometry +$PX+$PY -composite -matte /tmp/screen.png
echo "done"
done
fi
i3lock --24 -c '#FFFFFF' -o '#191d0f' -w '#572020' -l '#3497d4' -e -n -i /tmp/screen.png