dotfiles/bin/set_wallpaper

20 lines
479 B
Text
Raw Normal View History

#!/usr/bin/env bash
2020-12-21 18:32:41 +01:00
set -euo pipefail
IFS=$'\n\t'
WALLPAPER_DIRECTORY="$HOME/pictures/wallpapers/enabled"
2023-10-21 16:27:26 +02:00
HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf"
2020-12-21 18:32:41 +01:00
2023-10-21 16:27:26 +02:00
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
2024-03-19 20:24:58 +01:00
splash = false
2023-10-21 16:27:26 +02:00
EOF
fi