aboutsummaryrefslogtreecommitdiff
path: root/.scripts/preview
diff options
context:
space:
mode:
Diffstat (limited to '.scripts/preview')
-rwxr-xr-x.scripts/preview5
1 files changed, 4 insertions, 1 deletions
diff --git a/.scripts/preview b/.scripts/preview
index 822e5b0..18173ec 100755
--- a/.scripts/preview
+++ b/.scripts/preview
@@ -1,9 +1,12 @@
#!/usr/bin/env sh
+if [ -z "$1" ]; then exit 1; fi
+
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
case "$1" in
-*.tex | *.m[dse] | *.[rR]md | *.mom | *.[0-9]) compile "$1" && setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
+*.tex | *.m[dse] | *.[rR]md | *.mom | *.[0-9]) compile "$1" && preview "$basename".pdf >/dev/null 2>&1 ;;
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
+*) setsid -f xdg-open "$1" >/dev/null 2>&1 ;;
esac