From 682349094073f0e33951001edeac5c72c9f43145 Mon Sep 17 00:00:00 2001 From: BardofSprites <89086143+BardofSprites@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:20:00 -0400 Subject: don't clean cache file unless selected --- bin/.local/bin/scripts/wallpaper.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/.local/bin/scripts/wallpaper.sh b/bin/.local/bin/scripts/wallpaper.sh index 5e77767..ba230b0 100755 --- a/bin/.local/bin/scripts/wallpaper.sh +++ b/bin/.local/bin/scripts/wallpaper.sh @@ -1,13 +1,15 @@ #!/bin/bash -# Clean wallpaper cache file -sed -i '/feh/d' $HOME/.cache/wallpaper # Path to the directory containing your wallpapers WALLPAPER_DIRS="$HOME/Pictures/wallpaper/\n$HOME/Pictures/other-wallpaper/" WALLPAPER_DIR=$(echo -e "$WALLPAPER_DIRS" | dmenu -p "Select directory: ") +if [ -z "$WALLPAPER_DIR" ]; then + exit 1 +fi + # Use nsxiv to mark an image selected_wallpaper=$(nsxiv -t -r -o $WALLPAPER_DIR) @@ -17,6 +19,9 @@ OPTIONS="Tiled\nZoom Filled\nCentered\nMax" # Prompt user to select a display mode selected_mode=$(echo -e "$OPTIONS" | dmenu -p "Select Display Mode:") +# Clean wallpaper cache file +sed -i '/feh/d' $HOME/.cache/wallpaper + # Command to set wallpaper based on selected mode case "$selected_mode" in "Tiled") -- cgit v1.2.3