blob: 44486a1ae3d8a3db6bf098d0e305ef1833cdba3c (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/sh
set -efuo pipefail
letterEnteredColor=d23c3dff
letterRemovedColor=d23c3dff
passwordCorrect=00000000
passwordIncorrect=d23c3dff
background=00000000
foreground=ffffffff
screenshot=/tmp/screenshot.jpg
thumb=/tmp/screenshot-thumb.jpg
image=/tmp/screenshot-thumb.png
i3lock_color=no
opts="-e -n"
trap cleanup EXIT
cleanup() {
rm -f "${image}" "${screenshot}" "${thumb}"
}
if man i3lock | /bin/grep -q i3lock-color; then
i3lock_color=yes
fi
if command -v scrot >/dev/null 2>&1 && \
command -v convert >/dev/null 2>&1; then
if [ "${i3lock_color}" = 'yes' ]; then
# i3lock-color supports '*.jpg' for background
image=/tmp/screenshot-thumb.jpg
fi
rectangles=$(xrandr --query \
| grep ' connected' \
| grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*' \
| sed 's/[+x]/ /g' \
| awk '{ printf "rectangle %d %d %d %d ", $3+25, $2-30, $3+25+300, $2-30-80 }')
scrot -t 25% "${screenshot}"
convert "${thumb}" -blur 5x2 \
-resize 400% \
-draw "fill rgba(0, 0, 0, 0.4) ${rectangles}" \
"${image}"
rm -f "${screenshot}"
opts="${opts} -i ${image}"
fi
if [ "${i3lock_color}" = 'yes' ]; then
i3lock ${opts} \
--timepos="x+110:h-70" \
--datepos="x+130:h-45" \
--clock --datestr "Type password to unlock..." \
--insidecolor=$background --ringcolor=$foreground --line-uses-inside \
--keyhlcolor=$letterEnteredColor --bshlcolor=$letterRemovedColor --separatorcolor=$background \
--insidevercolor=$passwordCorrect --insidewrongcolor=$passwordIncorrect \
--ringvercolor=$foreground --ringwrongcolor=$foreground --indpos="x+280:h-70" \
--radius=20 --ring-width=4 --veriftext="" --wrongtext="" \
--verifcolor="$foreground" --timecolor="$foreground" --datecolor="$foreground" \
--noinputtext="" --time-font="SF Mono:style=Medium:size=20" \
--force-clock
else
i3lock ${opts} -u
fi
|