alps/contrib/hotreload.sh

14 lines
331 B
Bash
Raw Permalink Normal View History

2020-02-11 16:37:58 +00:00
#!/bin/sh
2020-05-13 12:07:44 +00:00
# Watch themes and plugins files, automatically reload alps on change.
2020-02-11 16:37:58 +00:00
events=modify,create,delete,move
targets="themes/ plugins/"
inotifywait -e "$events" -m -r $targets | while read line; do
2020-02-11 23:29:51 +00:00
jobs >/dev/null # Reap status of any terminated job
if [ -z "$(jobs)" ]; then
2020-05-13 12:07:44 +00:00
(sleep 0.5 && pkill -USR1 alps) &
2020-02-11 16:37:58 +00:00
fi
done