#!/bin/bash WALLPAPER_DIR="$HOME/wallpapers" CONFIG_FILE="$HOME/.config/hypr/hyprpaper.conf" # Find and sort image files naturally (handles numbers in filenames) mapfile -t wallpapers < <(find "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -print0 | sort -zV | xargs -0n1) # Write to config echo "# Generated by update_hyprpaper_config.sh" > "$CONFIG_FILE" for wp in "${wallpapers[@]}"; do echo "preload = $wp" >> "$CONFIG_FILE" done echo "Updated hyprpaper.conf with ${#wallpapers[@]} wallpapers."