14 lines
577 B
Bash
Executable File
14 lines
577 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
WALL_DIR="${1:-$HOME/.local/share/wallpapers}"
|
|
|
|
# Build list: display text = filename; icon = thumbnail of file; payload = full path
|
|
# Use NUL + unit-separator fields per rofi's extended dmenu protocol.
|
|
while IFS= read -r -d '' f; do
|
|
base="$(basename "$f")"
|
|
printf '%s\0icon\x1fthumbnail://%s\0info\x1f%s\n' "$base" "$f" "$f"
|
|
done < <(find "$WALL_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.webp' \) -print0 | sort -z)
|
|
|
|
# Run rofi dmenu, capturing the selected line (which includes the base text)
|