Remove screenshot before returning.

This commit is contained in:
dabruh 2022-06-10 17:50:07 +02:00
parent bf4576b29a
commit 8402b7d94b
1 changed files with 9 additions and 5 deletions

View File

@ -19,18 +19,20 @@ _unlock() {
}
lock() {
local screen=/tmp/screenshot.png blurred=/tmp/screenshotblur.png
local abort=false screen=/tmp/screenshot.png blurred=/tmp/screenshotblur.png
$LOCK_SCREEN_BLUR && scrot -q 100 $screen # Take screenshot
$LOCK_SCREEN_BLUR && sleep 0.25 && scrot -q 100 $screen # Take screenshot
_lock # Lock immediately
if [ -f $screen ]; then
# Blur screenshot
scrot -q 100 $screen || return 1 # Larger file size, but faster
convert -scale 10% -blur 0x1.25 -resize 1000% $screen $blurred || return 1
scrot -q 100 $screen || abort=true # Larger file size, but faster
convert -scale 10% -blur 0x1.25 -resize 1000% $screen $blurred || abort=true
rm $screen
$abort && return 1
# Now try to replace the solid color with the blurred image.
_unlock
i3lock -i $blurred || _lock
@ -42,7 +44,7 @@ lock() {
case "$1" in
lock)
lock; echo $?
lock
;;
logout)
i3-msg exit
@ -51,9 +53,11 @@ case "$1" in
dm-tool switch-to-greeter
;;
suspend)
export LOCK_SCREEN_BLUR=false
lock && $logind suspend
;;
hibernate)
export LOCK_SCREEN_BLUR=false
lock && $logind hibernate
;;
reboot)