Make inotifywait group multiple file updates into one?

Viewed 6016

I have a folder with Sphinx docs that I watch with inotifywait (from inotify-tools). The script re-builds the html & singlehtml and refreshes Chrome.

#!/bin/sh
inotifywait -mr source --exclude _build -e close_write -e create -e delete -e move | while read file event; do
    make html singlehtml
    xdotool search --name Chromium key --window %@ F5
done

This works fine when I save a single file. However, when I hg update to an old revision or paste multiple files in source folder, it fires the script for every single file.

Is there a simple workaround (without writing custom python scripts -- this I can do) to make it wait a fraction of a second before firing the script?

2 Answers
Related