Improve lock-screen
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c849ae1435
commit
6158275c6d
1 changed files with 28 additions and 2 deletions
30
bin/lock
30
bin/lock
|
@ -1,5 +1,31 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
xset dpms force off
|
||||
pgrep i3lock || i3lock -e -f -c 000000
|
||||
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 ${HOME}/.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' | sed 's/primary //' | 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 -e -f -n -i /tmp/screen.png
|
||||
|
|
Loading…
Add table
Reference in a new issue