dotfiles/bin/set_wallpaper
2023-10-21 16:27:26 +02:00

18 lines
464 B
Bash
Executable file

#!/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