mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
fill preview-tui preview (#907)
* fill preview pane * add xcf preview and fix formatting * test which convert * restore -bL
This commit is contained in:
parent
9f0a374255
commit
e0822fdef4
|
@ -143,7 +143,7 @@ preview_file () {
|
||||||
if [ -n "$ext" ]; then
|
if [ -n "$ext" ]; then
|
||||||
ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')"
|
ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')"
|
||||||
fi
|
fi
|
||||||
lines=$(($(tput lines)-1))
|
lines=$(tput lines)
|
||||||
cols=$(tput cols)
|
cols=$(tput cols)
|
||||||
|
|
||||||
# Otherwise, falling back to the defaults.
|
# Otherwise, falling back to the defaults.
|
||||||
|
|
|
@ -154,7 +154,7 @@ preview_file () {
|
||||||
if [ -n "$ext" ]; then
|
if [ -n "$ext" ]; then
|
||||||
ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')"
|
ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')"
|
||||||
fi
|
fi
|
||||||
lines=$(($(tput lines)-1))
|
lines=$(tput lines)
|
||||||
cols=$(tput cols)
|
cols=$(tput cols)
|
||||||
|
|
||||||
# Otherwise, falling back to the defaults.
|
# Otherwise, falling back to the defaults.
|
||||||
|
@ -170,6 +170,8 @@ preview_file () {
|
||||||
elif [ "$encoding" = "binary" ]; then
|
elif [ "$encoding" = "binary" ]; then
|
||||||
if [ "$ext" = "gif" ]; then
|
if [ "$ext" = "gif" ]; then
|
||||||
generate_preview "$cols" "$lines" "$1" "gif"
|
generate_preview "$cols" "$lines" "$1" "gif"
|
||||||
|
elif [ "${mimetype#*/}" = "x-xcf" ]; then
|
||||||
|
generate_preview "$cols" "$lines" "$1" "xcf"
|
||||||
elif [ "${mimetype%%/*}" = "image" ]; then
|
elif [ "${mimetype%%/*}" = "image" ]; then
|
||||||
image_preview "$cols" "$lines" "$1"
|
image_preview "$cols" "$lines" "$1"
|
||||||
elif [ "${mimetype%%/*}" = "audio" ] && exists ffmpeg; then
|
elif [ "${mimetype%%/*}" = "audio" ] && exists ffmpeg; then
|
||||||
|
@ -230,7 +232,7 @@ generate_preview() {
|
||||||
audio) ffmpeg -i "$3" "$TMPDIR/$3.jpg" -y >/dev/null 2>&1 ;;
|
audio) ffmpeg -i "$3" "$TMPDIR/$3.jpg" -y >/dev/null 2>&1 ;;
|
||||||
epub) gnome-epub-thumbnailer "$3" "$TMPDIR/$3.jpg" >/dev/null 2>&1 ;;
|
epub) gnome-epub-thumbnailer "$3" "$TMPDIR/$3.jpg" >/dev/null 2>&1 ;;
|
||||||
font) fontpreview -i "$3" -o "$TMPDIR/$3.jpg" >/dev/null 2>&1 ;;
|
font) fontpreview -i "$3" -o "$TMPDIR/$3.jpg" >/dev/null 2>&1 ;;
|
||||||
gif) if exists ueberzug || [ "$TERMINAL" = "kitty" ]; then
|
gif) if exists ueberzug && exists convert || [ "$TERMINAL" = "kitty" ]; then
|
||||||
if [ ! -d "$TMPDIR/$3" ]; then
|
if [ ! -d "$TMPDIR/$3" ]; then
|
||||||
mkdir -p "$TMPDIR/$3"
|
mkdir -p "$TMPDIR/$3"
|
||||||
convert -coalesce "$3" "$TMPDIR/$3/${3##*/}.jpg"
|
convert -coalesce "$3" "$TMPDIR/$3/${3##*/}.jpg"
|
||||||
|
@ -256,7 +258,8 @@ generate_preview() {
|
||||||
rm "$TMPDIR/$3.jpg"
|
rm "$TMPDIR/$3.jpg"
|
||||||
fifo_pager print_bin_info "$3"
|
fifo_pager print_bin_info "$3"
|
||||||
return
|
return
|
||||||
fi
|
fi ;;
|
||||||
|
xcf) convert -flatten "$3" "$TMPDIR/$3.jpg" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ -f "$TMPDIR/$3.jpg" ]; then
|
if [ -f "$TMPDIR/$3.jpg" ]; then
|
||||||
|
|
Loading…
Reference in a new issue