#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' WALLPAPER_DIRECTORY="$HOME/pictures/wallpapers/enabled" HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf" if [ -d "$WALLPAPER_DIRECTORY" ]; then WALLPAPER_FILE="$(find "$WALLPAPER_DIRECTORY" -type l -print | shuf | head -n 1)" if [ -L "$WALLPAPER_FILE" ]; then WALLPAPER_FILE="$(readlink -f "$WALLPAPER_FILE")" fi cat >"$HYPRPAPER_CNF" << EOF preload = $WALLPAPER_FILE wallpaper = ,$WALLPAPER_FILE EOF fi