Megnas-Config/.scripts/wallpaper-picker.sh
2026-02-19 20:27:50 +01:00

23 lines
658 B
Bash
Executable File

#!/usr/bin/env bash
DIR="$HOME/Wallpapers"
# Build list: filename<TAB>fullpath
file_list=$(find "$DIR" -type f 2>/dev/null | sort | while read -r f; do
printf "%s\t%s\n" "$(basename "$f")" "$f"
done)
# Show only filename column in wofi
selected_name=$(printf "%s\n" "$file_list" | cut -f1 | \
wofi --dmenu --prompt "Select file:")
# Get full path matching selected filename (first match)
if [[ -n "$selected_name" ]]; then
selected_file=$(printf "%s\n" "$file_list" | \
awk -F'\t' -v name="$selected_name" '$1 == name { print $2; exit }')
notify-send "Selected File" "$selected_file"
hyprctl hyprpaper wallpaper ",$selected_file,cover"
fi