nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 07c8089eafc04ff9a643dbd0fd224efbd21883de
parent 2c82c77a05001a8837f7a8a5df0f24c5548745a3
Author: Luuk van Baal <luukvbaal@gmail.com>
Date:   Fri, 24 Sep 2021 12:12:13 +0200

Preview without convert

Diffstat:
Mplugins/preview-tui | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/plugins/preview-tui b/plugins/preview-tui @@ -146,14 +146,14 @@ toggle_preview() { QLPATH="Bridge.exe" fi if kill "$(cat "$FIFOPID")"; then - printf "0" > "$NNN_PPIPE" + [ -p "$NNN_PPIPE" ] && printf "0" > "$NNN_PPIPE" kill "$(cat "$PREVIEWPID")" pkill -f "tail --follow $FIFO_UEBERZUG" if [ -n "$QLPATH" ] && stat "$1"; then f="$(wslpath -w "$1")" && "$QLPATH" "$f" & fi else - printf "1" > "$NNN_PPIPE" + [ -p "$NNN_PPIPE" ] && printf "1" > "$NNN_PPIPE" start_preview "$1" "$QLPATH" fi } >/dev/null 2>&1 @@ -333,7 +333,11 @@ generate_preview() { image_preview "$1" "$2" "$3" return 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%/*}" filename="$(printf "%s" "${3##*/}" | cut -d. -f1)" mv "$NNN_PREVIEWDIR/${3%/*}/$filename.jpg" "$NNN_PREVIEWDIR/$3.jpg" ;;