2022-05-08 11:54:07 +02:00
|
|
|
#!/usr/bin/env bash
|
2020-12-21 18:32:41 +01:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
|
2023-10-21 16:27:26 +02:00
|
|
|
HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf"
|
2025-01-04 11:31:43 +01:00
|
|
|
WALLPAPER_DIR="$HOME/pictures/wallpapers/enabled"
|
|
|
|
WALLPAPER_DIR_WINTER="$WALLPAPER_DIR/winter"
|
2020-12-21 18:32:41 +01:00
|
|
|
|
2025-01-04 11:31:43 +01:00
|
|
|
# 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 -print | shuf | head -n 1)"
|
2023-10-21 16:27:26 +02:00
|
|
|
if [ -L "$WALLPAPER_FILE" ]; then
|
|
|
|
WALLPAPER_FILE="$(readlink -f "$WALLPAPER_FILE")"
|
|
|
|
fi
|
|
|
|
cat >"$HYPRPAPER_CNF" << EOF
|
|
|
|
preload = $WALLPAPER_FILE
|
|
|
|
wallpaper = ,$WALLPAPER_FILE
|
2024-03-19 20:24:58 +01:00
|
|
|
splash = false
|
2023-10-21 16:27:26 +02:00
|
|
|
EOF
|
|
|
|
fi
|
2025-01-04 11:31:43 +01:00
|
|
|
|
|
|
|
# Set the wallpaper
|
|
|
|
hyprpaper
|