#!/bin/bash # wallpaper-picker.sh (Niri version) WALLPAPER_DIR="$HOME/Pictures/wallpaper" EXTENSIONS="jpg|jpeg|png|gif|webp|bmp|tiff|tga|svg|avif" declare -A wall_map while IFS= read -r path; do name=$(basename "$path") wall_map["$name"]="$path" done < <(find "$WALLPAPER_DIR" -maxdepth 1 -type f \ -regextype posix-extended -iregex ".*\.($EXTENSIONS)" | sort) chosen=$(printf '%s\n' "${!wall_map[@]}" | sort | \ wofi \ --dmenu \ --prompt " Wallpaper" \ --insensitive \ --no-actions \ --width 500 \ --height 400 \ ) [[ -z "$chosen" ]] && exit 0 full_path="${wall_map[$chosen]}" [[ ! -f "$full_path" ]] && { notify-send "wallpaper-picker" "Not found: $full_path" --urgency=critical exit 1 } awww img "$full_path" --transition-type grow --transition-step 90 persist="$HOME/.config/niri/wallpaper-restore.sh" mkdir -p "$(dirname "$persist")" printf '#!/bin/bash\nawww-daemon &\nsleep 0.5\nawww img "%s" --transition-type simple\n' "$full_path" > "$persist" chmod +x "$persist" notify-send "Wallpaper" "$chosen" --urgency=low