diff options
author | Anton Khirnov <wyskas@gmail.com> | 2009-04-20 20:53:34 +0200 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2009-04-21 07:58:12 +0200 |
commit | f34e63e8e40fed4b226d2ac899be36316945270e (patch) | |
tree | 5ac65d22b16272789459290e109c148e4179f870 | |
parent | 40064519e3f73f38aeab27507ae1dd0c9e9a56a5 (diff) |
Test for existence of programs in random_wallpaper.
-rwxr-xr-x | scripts/random_wallpaper.sh | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/random_wallpaper.sh b/scripts/random_wallpaper.sh index 213e6fc..aa47397 100755 --- a/scripts/random_wallpaper.sh +++ b/scripts/random_wallpaper.sh @@ -2,13 +2,14 @@ # Reads a given directory and set a random # wallpaper using the images on that dir. -if [[ -d "${WALLPAPERDIR}" ]] -then - 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" - feh --bg-center "${FVWM_USERDIR}/tmp/current_wall.png" -fi +[ -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" +feh --bg-center "${FVWM_USERDIR}/tmp/current_wall.png" exit 0 |