#!/bin/sh

# bg-picker - wallpaper picker using ThumbPick
# Opens ThumbPick with vim keybinds to browse wallpapers.
# On selection, runs setbg to apply the chosen wallpaper.

WALLPAPER_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/wallpapers"

[ -d "$WALLPAPER_DIR" ] || { notify-send "bg-picker" "No wallpapers directory found at $WALLPAPER_DIR"; exit 1; }

chosen="$(thumbpick "$WALLPAPER_DIR" -v)" || exit 1

[ -n "$chosen" ] && setbg "$chosen"
