From 8402b7d94b6405c40104e4fa5b557ea28c1ffbbd Mon Sep 17 00:00:00 2001 From: dabruh <11458706-dabruh@users.noreply.gitlab.com> Date: Fri, 10 Jun 2022 17:50:07 +0200 Subject: [PATCH] Remove screenshot before returning. --- .local/bin/i3exit | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.local/bin/i3exit b/.local/bin/i3exit index 19160a5..8a9aee7 100755 --- a/.local/bin/i3exit +++ b/.local/bin/i3exit @@ -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)