aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-06 14:27:39 +0200
committerJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-06 14:27:39 +0200
commit78582b12232810e1221e746f2c439a54019154fc (patch)
tree6c8655580727db10f8516b90ed1749acfcf76e60
parent6a06676909abd8e900a19138085a7929231f7bf3 (diff)
downloadxutil-78582b12232810e1221e746f2c439a54019154fc.tar.gz
wpdf: Note argument errors
-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