diff --git a/src/sh/cliinternal.sh b/src/sh/cliinternal.sh index 5e4675e..c1a0dda 100644 --- a/src/sh/cliinternal.sh +++ b/src/sh/cliinternal.sh @@ -20,19 +20,25 @@ if [ "${1:-}" = "--preview" ]; then "$AWK_PREVIEW" "$file" | $CAT # Get photo, if supported and if it exists - if [ "${CHAFA:-}" ]; then + if [ "${KITTY:-}" ]; then photo=$(mktemp) awk -v field="PHOTO" "$AWK_GET" "$file" | base64 -d -i >"$photo" type=$(file --mime-type -b "$photo" | cut -d '/' -f 1) - if [ "$type" = "image" ]; then - WIDTH=80 - if [ "$FZF_PREVIEW_COLUMNS" -lt "$WIDTH" ]; then - WIDTH="$FZF_PREVIEW_COLUMNS" - fi - $CHAFA -f symbols -s "$WIDTH" "$photo" + if [ "$type" != "image" ]; then + cat <"$photo" + + + +EOF fi - rm "$photo" + WIDTH=30 + if [ "$FZF_PREVIEW_COLUMNS" -lt "$WIDTH" ]; then + WIDTH="$FZF_PREVIEW_COLUMNS" + fi + $KITTY icat --clear --transfer-mode=memory --stdin=no --place="$WIDTH"x"$FZF_PREVIEW_LINES"@0x0 "$photo" + # $CHAFA -f symbols -s "$WIDTH" "$photo" fi + rm "$photo" exit fi diff --git a/src/sh/config.sh b/src/sh/config.sh index 4cef7c9..47f677e 100644 --- a/src/sh/config.sh +++ b/src/sh/config.sh @@ -65,9 +65,9 @@ if command -v "git" >/dev/null && [ -d "$ROOT/.git" ]; then export GIT fi -if command -v "chafa" >/dev/null; then - CHAFA="chafa" - export CHAFA +if command -v "kitty" >/dev/null; then + KITTY="kitty" + export KITTY fi export OPEN=${OPEN:-open}