I have the following code that monitors a directory for any new pictures that are placed into it by a camera. It's not working in it's current state, but the idea is that when it detects a new picture being created in the directory, it displays it in feh
fullscreened, wait's an amount of time and then kills the process to display the next one.
Currently, it hangs at the step of calling feh
and doesn't step any further until I manually escape out of feh
, but then the step to kill feh results in no feh process found
.
Ideally, I'd love to just be able to refresh feh
and have it display a new image for every image found, instead of killing it and calling it again but sadly each of the new images has a different file name.
#!/bin/bash
DIR="/path/to/pictures"
inotifywait -m -r -e create "$DIR" | while read path action file;
do
feh -F $DIR$file
sleep 10
kill -9 ($pidof feh)
done
&
tofeh ...
.