Add files/scripts/wallpaper-picker
This commit is contained in:
parent
b7ae15abe9
commit
27134d2454
1 changed files with 38 additions and 0 deletions
38
files/scripts/wallpaper-picker
Normal file
38
files/scripts/wallpaper-picker
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue