Install the inotify-tools, for example with yay:
yay -S inotify-tools
Then you can trigger a sphix build after a file change in docs
while true; inotifywait -e close_write -r docs/; make dirhtml; end
Or to start the love2d game, but only when a lua file changes.
while true; inotifywait -e close_write -r --include ".*\.lua" . ; love .; end
The inotifywait command waits until a file is updated, in our examples until a file handle is closed after a write.