From fba9579488fc57f87ee88700cf3d2635a5f531ca Mon Sep 17 00:00:00 2001 From: Harzo Date: Tue, 30 May 2023 23:11:13 +0200 Subject: [PATCH] random-wallpaper: Additional check Exit the script if no wallpapers could be find. This should prevent creating empty symbolic link to .current-wallpaper --- .scripts/system/random-wallpaper | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.scripts/system/random-wallpaper b/.scripts/system/random-wallpaper index cc14d00..f22fe00 100755 --- a/.scripts/system/random-wallpaper +++ b/.scripts/system/random-wallpaper @@ -11,6 +11,10 @@ interval_secs="$(echo "60 * ${INTERVAL}" | bc)" while true; do wallpaper="$(fd '\.(png|jpe?g|gif)$' "$WALLPAPER_DIR" --type f --type l -L | shuf | head -1)" + if [ -z "$wallpaper" ]; then + echo "Couldn't find any wallpapers. Abort" >&2 + exit 1 + fi ln -sf "$wallpaper" "/run/user/$(id -u)/.current-wallpaper" swww img "$wallpaper" sleep "$interval_secs"