aboutsummaryrefslogtreecommitdiff
path: root/wpdf
diff options
context:
space:
mode:
Diffstat (limited to 'wpdf')
-rwxr-xr-xwpdf13
1 files changed, 11 insertions, 2 deletions
diff --git a/wpdf b/wpdf
index 3e0e1aa..df9c71a 100755
--- a/wpdf
+++ b/wpdf
@@ -7,10 +7,19 @@ IFS='
[ -z "$*" ] && { echo usage: $0 source-file ... 1>&2; exit 1; }
+success=
for source in "$@"; do
- xpdf -remote wpdf-$source ${source%.*}.pdf &
+ case $source in
+ *.pdf) echo skipping $source: already a pdf 1>&2 ;;
+ *) success=1
+ xpdf -remote wpdf-$source ${source%.*}.pdf & ;;
+ esac
done
-sleep 1
+
+[ -z "$success" ] && exit 1
+xdotool search --sync --onlyvisible --class xpdf 1>&-
+sleep 0.2 || sleep 1
+
watch -i "$@" | while read source; do
make ${source%.*}.pdf && xpdf -remote wpdf-$source -reload
done