#!/usr/bin/env fish

if test (count $argv) -lt 1; or not test -d $argv[1] 
	echo "Usage: $(status filename) <dir>"
	exit 1
end

~/.config/scripts/set_background (
	for file in (fd -a -t f -d 1 -E "$(basename "$IMG")" -e jpg -e png -e webp . "$argv[1]")
		echo -en "$file\0icon\x1fthumbnail://$file\n"
	end | rofi -dmenu -p " " -show-icons -theme ~/.config/rofi/wallpapermenu.rasi
)
