--- /dev/null
+#!/usr/bin/env bash
+
+# -*- mode: shell-script -*-
+
+# Convert to PDF and display a libreoffice compatible document read
+# file on command line or else on stdandard in
+
+DEBUG=1
+
+C="$HOME/.cache/unoconv-display"
+tmp="/tmp/${0##*/}"
+mkdir -p "$C" "$tmp"
+test -n "$DEBUG" &&\
+ echo "[$(date -Is)] ${0##*/} D: Start." >> $tmp/log
+file=$1
+if [ -z "$file" ]; then
+ file="$tmp/$$"
+ cat > "$file"
+fi
+sha=$(sha1sum "$file");
+pdf="$C/${sha:0:16}.pdf"
+
+test -n "$DEBUG" &&\
+ echo "[$(date -Is)] ${0##*/} D: Continue for '$tmp', '$file', '$pdf'." >> $tmp/log
+
+if [ -f "$pdf" ]; then # Start PDF viewer
+ test -n "$DEBUG" &&\
+ echo "[$(date -Is)] ${0##*/} D: Found '$pdf'. Start PDF viewer." >> $tmp/log
+ exec zathura --fork "$pdf" 2>> "/tmp/err" &
+ rm -f "$tmp/$$"
+ exit 0
+fi
+
+test -n "$DEBUG" &&\
+ echo "[$(date -Is)] ${0##*/} D: Convert '$file' to '$pdf'." >> $tmp/log
+
+# Convert to PDF
+unoconv -f pdf -o "$pdf" "$file" || \
+ unoconv -l && \
+ unoconv -f pdf -o "$pdf" "$file"
+
+if [ -f "$pdf" ]; then # Recursively start evince
+ test -n "$DEBUG" &&\
+ echo "[$(date -Is)] [$(date -Is)] ${0##*/} D: Recursively for '$file'." >> $tmp/log
+ bash ${0} "$file"
+ exit $?
+fi
+
+echo "[$(date -Is)] [$(date -Is)] ${0##*/} E: Error. Why are we here?" >> $tmp/log
+exit 1