From a105dd3e907f7452eab234673e9960b1cdb47b81 Mon Sep 17 00:00:00 2001 From: furyan Date: Sun, 1 Jul 2018 14:33:23 +0200 Subject: [PATCH 1/2] Faster version of screen lock script by using scrot instead of import --- .config/i3/lock.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.config/i3/lock.sh b/.config/i3/lock.sh index 47bf091..92da398 100755 --- a/.config/i3/lock.sh +++ b/.config/i3/lock.sh @@ -4,23 +4,18 @@ timeout="10000" # Take a screenshot of every screen available: +scrot -m -z /tmp/lock.png xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' | { + cmd="convert" while IFS=' :x@,' read i w h x y; do - INDEX=$i - import -window root -crop ${w}x$h+$x+$y /tmp/head_$i.png + cmd+=" /tmp/lock.png -paint 1 -swirl 360 -crop ${w}x$h+$x+$y -geometry ${w}x$h+$x+$y ~/.config/i3/lock.png -gravity center -composite -matte" done + cmd+=" /tmp/screen.png" -# Add the lock to the swirled and blurred images: - for i in `seq 0 ${INDEX}`; - do - convert /tmp/head_${i}.png -paint 1 -swirl 360 ~/.config/i3/lock.png -gravity center -composite -matte /tmp/head_${i}.png; - done + eval $cmd } -#Combine all screen images into one big image -convert +append /tmp/head_*.png /tmp/screen.png - # Pause music (mocp and mpd): mocp -P mpc pause From d4f4c24071e997ed6587f9b959644a56ff50cd77 Mon Sep 17 00:00:00 2001 From: furyan Date: Thu, 5 Jul 2018 13:30:55 +0200 Subject: [PATCH 2/2] Fixing script for multimonitor after learning more about imagemagick and testing. --- .config/i3/lock.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.config/i3/lock.sh b/.config/i3/lock.sh index 92da398..f154487 100755 --- a/.config/i3/lock.sh +++ b/.config/i3/lock.sh @@ -7,11 +7,15 @@ timeout="10000" scrot -m -z /tmp/lock.png xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' | { - cmd="convert" + cmd="convert /tmp/lock.png" + cmdend="" while IFS=' :x@,' read i w h x y; do - cmd+=" /tmp/lock.png -paint 1 -swirl 360 -crop ${w}x$h+$x+$y -geometry ${w}x$h+$x+$y ~/.config/i3/lock.png -gravity center -composite -matte" + cmd+=" -region ${w}x$h+$x+$y -paint 1 -swirl 360" + xc=$((x+(w/2)-79)) + yc=$((y+(h/2)-79)) + cmdend+=" ~/.config/i3/lock.png -geometry +${xc}+${yc} -composite -matte" done - cmd+=" /tmp/screen.png" + cmd+="${cmdend} /tmp/screen.png" eval $cmd }