From 0f3f9ebfb23992d53a400f5ccd636166f62a3fa0 Mon Sep 17 00:00:00 2001 From: "committer@tuxwarrior" Date: Mon, 7 Apr 2025 19:48:03 -0500 Subject: [PATCH] /+ added feature to break the screen lock process --- dots/bin/i3lock_fk.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/dots/bin/i3lock_fk.sh b/dots/bin/i3lock_fk.sh index 00899aa..0f47f3c 100755 --- a/dots/bin/i3lock_fk.sh +++ b/dots/bin/i3lock_fk.sh @@ -12,21 +12,32 @@ random_image_filname="$(basename -- $random_image)" gravity=("northeast" "southeast") # "center" "northwest" "northeast" "southwest" "southeast" random_gravity=${gravity[ $RANDOM % ${#gravity[@]} ]} -# send a notification to the user -notify-send "${random_image_filname} @ ${random_gravity}" - # take a screenshot of the entire screen, and blur this scrot --overwrite /tmp/currentworkspace.png magick /tmp/currentworkspace.png -blur 0x9 /tmp/currentworkspaceblur.png -# find height of background image, and set the overlay to be 1/3 of this -workspaceHeight=$(magick /tmp/currentworkspaceblur.png -print "%h" /dev/null) -overlayHeight=$((${workspaceHeight} / 3)) +# send a notification to the user after the screenshot is taken, to avoid including the notification +notify-send "LOCKING SCREEN" "The system is about to be locked.\nPress any key to stop this from happening.\n\n${random_image_filname} @ ${random_gravity}" -# resize the overlay image -cp ${random_image} /tmp/overlayimage.png -mogrify -resize x${overlayHeight} /tmp/overlayimage.png +# https://linuxsimply.com/bash-scripting-tutorial/input-output/input/wait-for-input/ +read -t 15 -n 1 key # read a single character within a X-seconds period +if [ $? = 0 ]; then -# create the final image to be used as the lock screen, and lock the system -composite -gravity ${random_gravity} /tmp/overlayimage.png /tmp/currentworkspaceblur.png /tmp/lockbackground.png -i3lock --tiling -i /tmp/lockbackground.png + notify-send "'${key}' is pressed ➔ the screen will not be locked" + exit + +else + + # find height of background image, and set the overlay to be 1/3 of this + workspaceHeight=$(magick /tmp/currentworkspaceblur.png -print "%h" /dev/null) + overlayHeight=$((${workspaceHeight} / 3)) + + # resize the overlay image + cp ${random_image} /tmp/overlayimage.png + mogrify -resize x${overlayHeight} /tmp/overlayimage.png + + # create the final image to be used as the lock screen, and lock the system + composite -gravity ${random_gravity} /tmp/overlayimage.png /tmp/currentworkspaceblur.png /tmp/lockbackground.png + i3lock --tiling -i /tmp/lockbackground.png + +fi \ No newline at end of file