diff --git a/.scripts/zat b/.scripts/zat index f6929bf9..7d3379f6 100755 --- a/.scripts/zat +++ b/.scripts/zat @@ -3,17 +3,11 @@ [ -z "$VIEWER" ] && VIEWER="zathura --fork" for i; do - basename=${i##*/} - ext=${basename##*.} - - case "$ext" in - bz2) bzcat "$i" ;; - bz) bzcat "$i" ;; - gz) zcat "$i" ;; - lrz) lrzcat "$i" ;; - lz) lzcat "$i" ;; - lz4) lz4cat "$i" ;; - xz) xzcat "$i" ;; - *) cat "$i" ;; - esac | $VIEWER - + if $(file -i -b "$i" | grep -qi 'pdf\|postscript\|djvu'); then + $VIEWER "$i" + else + ## The drawback of reading from stdin is that zathura will not save the + ## position. + acat "$i" | $VIEWER - + fi done