diff options
author | Anton Khirnov <wyskas@gmail.com> | 2009-04-26 19:41:58 +0200 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2009-04-26 21:24:38 +0200 |
commit | 4b7cf06964db4f5d6ba87e4523a0e868aa5d3ebc (patch) | |
tree | fdb4eac706b1ee092494110946e3aec77ffea266 | |
parent | 082aea604fb2e2fa59c9b913d3b0a8abf9bec429 (diff) |
random_wallpaper: fallback to default_wall.
-rwxr-xr-x | scripts/random_wallpaper.sh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/random_wallpaper.sh b/scripts/random_wallpaper.sh index aa47397..d4f3386 100755 --- a/scripts/random_wallpaper.sh +++ b/scripts/random_wallpaper.sh @@ -2,14 +2,19 @@ # Reads a given directory and set a random # wallpaper using the images on that dir. -[ -d "${WALLPAPERDIR}" ] || exit 1 [ -x /usr/bin/convert ] || exit 1 [ -x /usr/bin/feh ] || exit 1 -files=$(ls "${WALLPAPERDIR}") -file_matrix=($files) -num_files=${#file_matrix[*]} -convert "${WALLPAPERDIR}/${file_matrix[$((RANDOM%num_files))]}" -resize `xdpyinfo |grep dimensions|awk '{print $2}'` "${FVWM_USERDIR}/tmp/current_wall.png" +if [ -d "${WALLPAPERDIR}" ]; then + files=$(ls "${WALLPAPERDIR}") + file_matrix=($files) + num_files=${#file_matrix[*]} + file = "${WALLPAPERDIR}/${file_matrix[$((RANDOM%num_files))]}" +else + file = ${FVWM_USERDIR}/images/default_wall.jpg +fi + +convert ${file} -resize `xdpyinfo |grep dimensions|awk '{print $2}'` "${FVWM_USERDIR}/tmp/current_wall.png" feh --bg-center "${FVWM_USERDIR}/tmp/current_wall.png" exit 0 |