diff --git a/files/scripts/wallpaper-picker b/files/scripts/wallpaper-picker new file mode 100644 index 0000000..f681d87 --- /dev/null +++ b/files/scripts/wallpaper-picker @@ -0,0 +1,38 @@ +#!/bin/bash +# wallpaper-picker.sh + +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/hypr/wallpaper-restore.sh" +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 \ No newline at end of file