Preview without convert

This commit is contained in:
Luuk van Baal 2021-09-24 12:12:13 +02:00
parent 2c82c77a05
commit 07c8089eaf

View file

@ -146,14 +146,14 @@ toggle_preview() {
QLPATH="Bridge.exe" QLPATH="Bridge.exe"
fi fi
if kill "$(cat "$FIFOPID")"; then if kill "$(cat "$FIFOPID")"; then
printf "0" > "$NNN_PPIPE" [ -p "$NNN_PPIPE" ] && printf "0" > "$NNN_PPIPE"
kill "$(cat "$PREVIEWPID")" kill "$(cat "$PREVIEWPID")"
pkill -f "tail --follow $FIFO_UEBERZUG" pkill -f "tail --follow $FIFO_UEBERZUG"
if [ -n "$QLPATH" ] && stat "$1"; then if [ -n "$QLPATH" ] && stat "$1"; then
f="$(wslpath -w "$1")" && "$QLPATH" "$f" & f="$(wslpath -w "$1")" && "$QLPATH" "$f" &
fi fi
else else
printf "1" > "$NNN_PPIPE" [ -p "$NNN_PPIPE" ] && printf "1" > "$NNN_PPIPE"
start_preview "$1" "$QLPATH" start_preview "$1" "$QLPATH"
fi fi
} >/dev/null 2>&1 } >/dev/null 2>&1
@ -333,7 +333,11 @@ generate_preview() {
image_preview "$1" "$2" "$3" image_preview "$1" "$2" "$3"
return return
fi ;; fi ;;
image) convert "$3" -flatten -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$NNN_PREVIEWDIR/$3.jpg" ;; image) if exists convert; then
convert "$3" -flatten -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$NNN_PREVIEWDIR/$3.jpg"
else
image_preview "$1" "$2" "$3" && return
fi ;;
office) libreoffice --convert-to jpg "$3" --outdir "$NNN_PREVIEWDIR/${3%/*}" office) libreoffice --convert-to jpg "$3" --outdir "$NNN_PREVIEWDIR/${3%/*}"
filename="$(printf "%s" "${3##*/}" | cut -d. -f1)" filename="$(printf "%s" "${3##*/}" | cut -d. -f1)"
mv "$NNN_PREVIEWDIR/${3%/*}/$filename.jpg" "$NNN_PREVIEWDIR/$3.jpg" ;; mv "$NNN_PREVIEWDIR/${3%/*}/$filename.jpg" "$NNN_PREVIEWDIR/$3.jpg" ;;