From f5b45be594d7157ac68c5c7ce4cbca7cb22b77be Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Wed, 17 Sep 2025 00:14:11 +0300 Subject: [PATCH] feat: random wallpaper script for both screens --- hypr/scripts/random_wallpaper.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hypr/scripts/random_wallpaper.sh b/hypr/scripts/random_wallpaper.sh index 2b00e4d..2a22e73 100755 --- a/hypr/scripts/random_wallpaper.sh +++ b/hypr/scripts/random_wallpaper.sh @@ -2,7 +2,7 @@ WALLPAPER_DIR="$HOME/Pictures/Wallpapers/current/" INTRO_DIR="$HOME/Pictures/Wallpapers/intro/" -DELAY=5m +DELAY=3m intro() { if [ -z "$(ls -A "$WALLPAPER_DIR")" ]; then @@ -40,15 +40,23 @@ random_wallpaper() { # Apply the selected wallpaper hyprctl hyprpaper unload all - hyprctl hyprpaper reload ,"$WALLPAPER" + hyprctl hyprpaper reload $1,"$WALLPAPER" + + if [ $? -ne 0 ]; then + echo "The previous command failed." + # Handle the error here + hyprpaper & + sleep 1 + hyprctl hyprpaper reload ,"$WALLPAPER" + fi echo "Set random wallpaper to $WALLPAPER" } loop() { - intro while true; do - random_wallpaper + random_wallpaper "eDP-1" + random_wallpaper "HDMI-A-1" sleep "$DELAY" done }