dotfiles/bin/set_wallpaper
2024-03-19 20:24:58 +01:00

19 lines
479 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
splash = false
EOF
fi