Randomly shuffle over 20 images script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Assuming this Wallpapers folder is a nas mount | |
IMAGE_DIR="/home/user/Wallpapers/cats/" | |
TMP_DIR="/tmp/wallpapers" | |
NUM_IMAGES=20 | |
# Create temporary directory if it doesn't exist | |
mkdir -p $TMP_DIR | |
# Check if the temporary directory is empty | |
if [ -z "$(ls -A $TMP_DIR)" ]; then | |
# Find and copy 20 random images to the temporary directory | |
find $IMAGE_DIR -type f \( -iname \*.jpg -o -iname \*.jpeg -o -iname \*.png -o -iname \*.gif \) | shuf -n $NUM_IMAGES | xargs -I {} cp {} $TMP_DIR | |
fi | |
# Set wallpaper using feh | |
feh --bg-max --randomize $TMP_DIR/* | |
# Optional: You might want to remove the copied images from /tmp after some time | |
# rm -f $TMP_DIR/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment