2025-01-12 21:32:27 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# This script will randomly go through the files of a directory, setting it
|
|
|
|
# up as the wallpaper at regular intervals
|
|
|
|
#
|
|
|
|
# NOTE: this script is in bash (not posix shell), because the RANDOM variable
|
|
|
|
# we use is not defined in posix
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
|
|
|
|
echo "Usage:
|
|
|
|
$0 <dir containing images>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Edit below to control the images transition
|
|
|
|
export SWWW_TRANSITION_FPS=120
|
|
|
|
export SWWW_TRANSITION_DURATION=1
|
|
|
|
export SWWW_TRANSITION_STEP=2
|
|
|
|
|
|
|
|
# This controls (in seconds) when to switch to the next image
|
2025-01-13 17:11:38 +00:00
|
|
|
#INTERVAL=30
|
2025-01-12 21:32:27 +00:00
|
|
|
|
2025-01-13 17:11:38 +00:00
|
|
|
#while true; do
|
|
|
|
find "$1" -type f \( -iname \*.jpg -o -iname \*.jpeg -o -iname \*.png -o -iname \*.webp \) \
|
2025-01-12 21:32:27 +00:00
|
|
|
| while read -r img; do
|
|
|
|
echo "$((RANDOM % 1000)):$img"
|
|
|
|
done \
|
|
|
|
| sort -n | cut -d':' -f2- \
|
|
|
|
| while read -r img; do
|
|
|
|
swww img "$img"
|
2025-01-13 17:11:38 +00:00
|
|
|
#sleep $INTERVAL
|
|
|
|
break
|
2025-01-12 21:32:27 +00:00
|
|
|
done
|
2025-01-13 17:11:38 +00:00
|
|
|
#done
|
|
|
|
|