-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlock
executable file
·52 lines (44 loc) · 1.33 KB
/
lock
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
#!/usr/bin/env bash
icon=$HOME/Pictures/locks/rmlock.png
tmpbg='/tmp/screen.png'
(( $# )) && { icon=$1; }
scrot "$tmpbg"
echo $(date)
#convert "$tmpbg" -scale 10% -scale 1000% -gamma 0.7 "$tmpbg"
if [[ -f $icon ]]
then
# placement x/y
PX=0
PY=0
# lockscreen image info
R=$(file $icon | grep -o '[0-9]* x [0-9]*')
echo $(date)
echo $R
RX=$(echo $R | cut -d' ' -f 1)
RY=$(echo $R | cut -d' ' -f 3)
# SR=$(xrandr --query | grep ' connected' | cut -f3 -d' ')
SR=$(cat <<EOF
1920x1080+0+0
1920x1080+1920+0
EOF
)
echo $SR
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))
echo "$tmpbg" "$icon" -geometry +$PX+$PY -composite -matte "$tmpbg"
#convert "$tmpbg" "$icon" -geometry +$PX+$PY -composite -matte "$tmpbg"
echo "done"
done
fi
# convert "$tmpbg" "$icon" -gravity center -composite -matte "$tmpbg"
# play $HOME/Noooo.mp3 &
amixer set Master mute
i3lock -u -i "$tmpbg" -n; amixer set Master unmute
rm "$tmpbg"