dotfiles-x11/.local/bin/randomwall

18 lines
468 B
Bash
Executable File

#!/bin/bash
WALL_DIR="$HOME/pix/wallpapers/onedarkwallpapers/"
NEW_WALL=$(find "$WALL_DIR" -type f | shuf -n 1)
if ! pgrep -x hyprpaper >/dev/null; then
# hyprpaper not running → write config and start it
cat > ~/.config/hypr/hyprpaper.conf <<EOF
preload = $NEW_WALL
wallpaper = ,$NEW_WALL
EOF
hyprpaper &
else
# hyprpaper is running → just update it live
hyprctl hyprpaper preload "$NEW_WALL"
hyprctl hyprpaper wallpaper ",$NEW_WALL"
fi