I use the llpp pdf viewer when editing my LaTeX files. To have it automatically refreshing the pdf file when I compile, I use a wrapper to launch it (cf. this).
The part handling the waiting and refreshing is this one :
inotifywait -m -e close_write $1 | while read; do
kill -HUP $pid_llpp
done &
My problem is the following : whenever an error occurs in the compilation of the tex file, no pdf output is procuded and llpp is closing. I tried something like that :
inotifywait -m -e close_write $1 | while read; do
if [ -a $1 ]
then
kill -HUP $pid_llpp
fi
done &
It works partially : when an error occurs during the compilation, llpp doesn't close but does not refresh anymore...
Could anyone help me to solve this problem ?
Update: Since release v26 llpp ships the wrapper script in an polished version! You find it as misc/llpp.inotify in the llpp distribution.
I pushed a partial fix to your problem (full script here):
inotifywait -m -e close_write "$PWD" | while read dir ev file; do
if [ "$file" = "$pdf" ] && [ -e "$pdf" ]; then
kill -HUP $pid_llpp
fi
done &
This checks whether the current pdf file is still available and only then fires the update event. This is similar to what you have done. However I can still be the case that llpp will close as the file might disappear directly after the check. I have no idea how to tackle this.
The problem of not refreshing after the error has been fixed is solved by watching the folder containing the pdf and filtering out the events for the pdf. If inotify is call directly on the file it seems to miss all events after delete
.
If you are still interested in it, please let me know if it works for you.
(As a side note: The wrapper is now also able to pass flags to llpp)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With