blob: 7e792f0226d815c0569f225a9627d29b19494eff (
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
66
67
|
#!/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} \
--time-pos="x+110:h-70" \
--date-pos="x+130:h-45" \
--clock --date-str "Type password to unlock..." \
--inside-color=$background --ring-color=$foreground --line-uses-inside \
--keyhl-color=$letterEnteredColor \
--bshl-color=$letterRemovedColor --separator-color=$background \
--insidever-color=$passwordCorrect --insidewrong-color=$passwordIncorrect \
--ringver-color=$foreground --ringwrong-color=$foreground \
--ind-pos="x+280:h-70" \
--radius=20 --ring-width=4 --verif-text="" --wrong-text="" \
--verif-color="$foreground" --time-color="$foreground" --date-color="$foreground" \
--noinput-text="" --time-font="SF Mono:style=Medium:size=20" \
--force-clock
else
i3lock ${opts} -u
fi
|