#!/bin/bash

DIR="$HOME/wallpapers"

FILES=($(find "$DIR" -type f \( -iname "*.jpg" -o -iname "*.png" -o -iname "*.jpeg" \) | sort -f | xargs -n1 basename))

SELECTED=$(printf '%s\n' "${FILES[@]}" | wofi --dmenu --prompt "choose wallpaper" --normal-window)

if [ -n "$SELECTED" ]; then
    FULLPATH="$DIR/$SELECTED"

    # Применяем выбранный обои и делаем прочее
    swww img "$FULLPATH" --transition-type wipe --transition-fps 60 --transition-angle 30 --transition-duration 1
    matugen image "$FULLPATH" -t scheme-fruit-salad
    notify-send "wallpaper changed" "$FULLPATH"
fi

