33 lines
833 B
Bash
Executable file
33 lines
833 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf"
|
|
WALLPAPER_DIR="$HOME/pictures/wallpapers"
|
|
WALLPAPER_DIR_WINTER="$WALLPAPER_DIR/winter"
|
|
|
|
# Set the wallpaper directory based on the current month
|
|
case "$(date '+%m')" in
|
|
"01"|"02"|"11"|"12")
|
|
if [ -d "$WALLPAPER_DIR_WINTER" ]; then
|
|
WALLPAPER_DIR="$WALLPAPER_DIR_WINTER"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
# Generate the configuration
|
|
if [ -d "$WALLPAPER_DIR" ]; then
|
|
WALLPAPER_FILE="$(find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname "*\.png" -o -iname "*\.jpg" -o -iname "*\.jpeg" \) -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
|
|
|
|
# Set the wallpaper
|
|
hyprpaper
|