Improve the wallpaper script

This commit is contained in:
Rodolphe Bréard 2025-01-04 11:31:43 +01:00
parent 4e8dd3ad51
commit 07a91ea136
Signed by: rodolphe
SSH key fingerprint: SHA256:3rodCKnk1MUOfSlIKY0nHbBtvFyQx4EqjS+JIy69lN0
2 changed files with 18 additions and 4 deletions

View file

@ -43,7 +43,7 @@ $lock = swaylock --color=000000 --daemonize
# exec-once = $terminal # exec-once = $terminal
# exec-once = nm-applet & # exec-once = nm-applet &
# exec-once = waybar & hyprpaper & firefox # exec-once = waybar & hyprpaper & firefox
exec-once = ~/.local/bin/set_wallpaper && hyprpaper exec-once = ~/.local/bin/set_wallpaper
exec-once = waybar exec-once = waybar

View file

@ -3,11 +3,22 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
WALLPAPER_DIRECTORY="$HOME/pictures/wallpapers/enabled"
HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf" HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf"
WALLPAPER_DIR="$HOME/pictures/wallpapers/enabled"
WALLPAPER_DIR_WINTER="$WALLPAPER_DIR/winter"
if [ -d "$WALLPAPER_DIRECTORY" ]; then # Set the wallpaper directory based on the current month
WALLPAPER_FILE="$(find "$WALLPAPER_DIRECTORY" -type l -print | shuf | head -n 1)" 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)"
if [ -L "$WALLPAPER_FILE" ]; then if [ -L "$WALLPAPER_FILE" ]; then
WALLPAPER_FILE="$(readlink -f "$WALLPAPER_FILE")" WALLPAPER_FILE="$(readlink -f "$WALLPAPER_FILE")"
fi fi
@ -17,3 +28,6 @@ wallpaper = ,$WALLPAPER_FILE
splash = false splash = false
EOF EOF
fi fi
# Set the wallpaper
hyprpaper