2024-05-19 17:35:37 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2025-04-04 04:58:01 -05:00
|
|
|
# originally got the idea from this script:
|
2024-05-19 17:35:37 -05:00
|
|
|
# src:https://github.com/veltall/custom-i3lock
|
|
|
|
|
|
2025-04-04 04:58:01 -05:00
|
|
|
# get random image to use
|
|
|
|
|
# https://stackoverflow.com/questions/61290199/how-do-i-select-a-random-file-from-a-directory
|
|
|
|
|
random_image=$(ls -1 /home/${USER}/.local/share/img/*.png | shuf | head -1)
|
|
|
|
|
random_image_filname="$(basename -- $random_image)"
|
2024-05-19 17:46:08 -05:00
|
|
|
|
2025-04-04 04:58:01 -05:00
|
|
|
# get random gravity to use for the overlay image
|
|
|
|
|
gravity=("northeast" "southeast") # "center" "northwest" "northeast" "southwest" "southeast"
|
2024-05-19 17:48:18 -05:00
|
|
|
random_gravity=${gravity[ $RANDOM % ${#gravity[@]} ]}
|
2024-05-19 17:46:08 -05:00
|
|
|
|
2025-04-04 04:58:01 -05:00
|
|
|
# send a notification to the user
|
|
|
|
|
notify-send "${random_image_filname} @ ${random_gravity}"
|
2024-05-19 18:53:45 -05:00
|
|
|
|
2025-04-04 04:58:01 -05:00
|
|
|
# take a screenshot of the entire screen, and blur this
|
2024-05-20 07:11:18 -05:00
|
|
|
scrot --overwrite /tmp/currentworkspace.png
|
2025-04-04 07:14:14 -05:00
|
|
|
magick /tmp/currentworkspace.png -blur 0x9 /tmp/currentworkspaceblur.png
|
2025-04-04 04:58:01 -05:00
|
|
|
|
|
|
|
|
# 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
|
2024-05-20 07:11:18 -05:00
|
|
|
i3lock --tiling -i /tmp/lockbackground.png
|