#!/bin/sh
# Sets the background image to a slideshow

DIR="$1"
SHOW="$HOME/.config/wallpaper/slideshow"
find $DIR > $SHOW

# begin loop
while :;
do
 for IMG in `cat $SHOW | grep --extended-regexp "jpg|jpeg|png|gif|tif|tiff|svg"`
 do
  # re-source the preferences file in case the interval has changed
  . $HOME/.config/wallpaper/preferences
  wallpaper $IMG
  sleep $INT
 done
done
