-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathi3lockImage.sh
More file actions
executable file
·52 lines (43 loc) · 1.3 KB
/
i3lockImage.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.3 KB
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
#!/bin/bash
# i3lock blurred screen inspired by /u/patopop007 and the blog post
# http://plankenau.com/blog/post-10/gaussianlock
# Timings are on an Intel i7-2630QM @ 2.00GHz
# Dependencies:
# imagemagick
# i3lock
# scrot (optional but default)
IMAGE=/tmp/i3lock.png
rm $IMAGE
SCREENSHOT="scrot $IMAGE" # 0.46s
# Alternate screenshot method with imagemagick. NOTE: it is much slower
# SCREENSHOT="import -window root $IMAGE" # 1.35s
# Here are some imagemagick blur types
# Uncomment one to use, if you have multiple, the last one will be used
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
BLURTYPE="0x8" # 7.52s
#BLURTYPE="0x2" # 4.39s
#BLURTYPE="5x2" # 3.80s
# BLURTYPE="2x8" # 2.90s
#BLURTYPE="2x3" # 2.92s
# Get the screenshot, add the blur and lock the screen with it
$SCREENSHOT
SIZE=`identify $IMAGE | cut -f 3 -d " "`
echo $SIZE
R=$((RANDOM % 2))
case $R in
# 0)
# # head injury lock
# convert $IMAGE \( -size $SIZE gradient: -rotate -270 \) \( -size 1x1440 gradient: -spread 128 -scale $SIZE\! \) -compose Distort -define compose:args='' -composite $IMAGE
# ;;
0)
# pixelated lock
convert $IMAGE -sample 7% -scale $SIZE\! $IMAGE
;;
*)
# blurred lock
convert $IMAGE -blur $BLURTYPE $IMAGE
esac
# xdg-open $IMAGE
i3lock -i $IMAGE
# 1440 4480
# rm $IMAGE