summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJake Koroman <jake@jakekoroman.com>2025-10-03 13:30:08 -0400
committerJake Koroman <jake@jakekoroman.com>2025-10-03 13:30:08 -0400
commite7cf5775afcd25b7a22204d1295e400dd71e8b88 (patch)
tree82f3ae0a9a31b44fbce35a9cc2325a23556ff06c /scripts
parent268ed22e44463523723c428826d40628e1b89953 (diff)
scripts/change_wallpaper: add error handling.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/change_wallpaper6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/change_wallpaper b/scripts/change_wallpaper
index 57895b3..11bf82c 100755
--- a/scripts/change_wallpaper
+++ b/scripts/change_wallpaper
@@ -1,8 +1,12 @@
#!/bin/sh
-wallpaper=$(ls ~/pictures/wallpapers/ | dmenu -p "Wallpaper: " -i -l 16)
+wallpaper_dir="$HOME/pictures/wallpapers"
+wallpaper=$(ls "$wallpaper_dir" | dmenu -p "Wallpaper: " -i -l 16)
+[ -z "$wallpaper" ] && exit 1
+[ ! -e "$wallpaper_dir/$wallpaper" ] && exit 1
cd ~/pictures
rm -f wallpaper
ln -s "wallpapers/$wallpaper" wallpaper
xwallpaper --zoom ~/pictures/wallpaper &
+cd - > /dev/null