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