#!/usr/bin/env bash # Folder with full-size wallpapers WALLPAPER_DIR="$HOME/Pictures/Wallpapers" # Folder to store thumbnails THUMB_DIR="$HOME/.cache/wallpaper-thumbs" if [ ! -d $THUMB_DIR ]; then mkdir -p $THUMB_DIR; fi # Make sure the thumb directory exists mkdir -p "$THUMB_DIR" # Max width/height of the thumbnails MAX_DIM=300 # Process each image for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do # Skip if no files match [ -e "$img" ] || continue # Get just the filename fname=$(basename "$img") # Output path thumb="$THUMB_DIR/$fname" # If thumbnail already exists and is newer than the original, skip if [ -f "$thumb" ] && [ "$thumb" -nt "$img" ]; then continue fi # Generate thumbnail using ImageMagick magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb" done echo "Thumbnails generated in $THUMB_DIR" Process { id: generateThumbs command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/generate-wallpaper-thumbs.sh" + " " + model.filePath + " &"] stdout: StdioCollector { onStreamFinished: console.log(`line read: ${this.text}`) } } generateThumbs.startDetached()