# Deploy wallpapers to ~/wallpapers/ — the path hyprpaper.conf preloads from
# (.config/hypr/hyprpaper.conf references /home/<user>/wallpapers/*.jpg).
SRC="$REPO_ROOT/03-user/wallpapers"
DEST="$HOME/wallpapers"
find_wp() { find "$SRC" -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) "$@"; }

if [ -z "$(find_wp -print -quit 2>/dev/null)" ]; then
  echo "   no wallpapers in 03-user/wallpapers — skipping"
  return 0 2>/dev/null || exit 0
fi

count=0
while IFS= read -r -d '' img; do
  install -Dm644 "$img" "$DEST/$(basename "$img")" && count=$((count + 1))
done < <(find_wp -print0)

info "deployed $count wallpaper(s) → $DEST"
