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

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

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