Update blob_wallpaper script to use ~/wallpapers directory

This commit is contained in:
2026-04-20 12:21:16 -04:00
parent 8a081737d3
commit 68a165862d
2 changed files with 18 additions and 5 deletions
+17 -5
View File
@@ -1,13 +1,25 @@
#!/bin/bash
WALLPAPER_DIR="$HOME/wallpapers"
# Create the directory if it doesn't exist
mkdir -p "$WALLPAPER_DIR"
if [ -z "$1" ]; then
echo "Usage: blob_wallpaper <path-to-image>"
echo "Usage: blob_wallpaper <filename-or-path>"
echo "Available wallpapers in $WALLPAPER_DIR:"
ls -1 "$WALLPAPER_DIR" 2>/dev/null || echo "No wallpapers found."
exit 1
fi
IMAGE_PATH=$(realpath "$1")
if [ ! -f "$IMAGE_PATH" ]; then
echo "Error: File '$IMAGE_PATH' does not exist."
# Check if the argument is a file in the wallpapers directory
if [ -f "$WALLPAPER_DIR/$1" ]; then
IMAGE_PATH=$(realpath "$WALLPAPER_DIR/$1")
# Check if the argument is an absolute or relative path
elif [ -f "$1" ]; then
IMAGE_PATH=$(realpath "$1")
else
echo "Error: File '$1' does not exist in $WALLPAPER_DIR or as a valid path."
exit 1
fi