#!/bin/bash

Wallpaper_DIR="/home/smayzy/Wallpaper"

set_wallpaper() {
    local Wallpaper=$(find $Wallpaper_DIR -type f | shuf -n 1)
    
    > /home/smayzy/.config/hypr/hyprpaper.conf

    echo "preload = $Wallpaper" >> /home/smayzy/.config/hypr/hyprpaper.conf
    echo "wallpaper = ,$Wallpaper" >> /home/smayzy/.config/hypr/hyprpaper.conf

    # Restart hyprpaper
    killall hyprpaper 2>/dev/null
    hyprpaper &
}

while true; do
    set_wallpaper
    sleep 600
done

