diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-26 21:36:57 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-26 22:28:15 +0900 |
| commit | 3277e8c89c2eaf18a1eb99898cdab79eb0be23d7 (patch) | |
| tree | 69f128c3b067e589bb3bb04884398f7ea18ad161 /bin | |
| parent | d02b9442a56ec03dbb905d432762cf545603ef07 (diff) | |
| download | fzf-3277e8c89c2eaf18a1eb99898cdab79eb0be23d7.tar.gz | |
Remove $FZF_PREVIEW_PIXEL_{WIDTH,HEIGHT} (#2544)
They are not neccessary because we can use a program such as chafa that
can resize images by the terminal columns and lines.
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/fzf-preview.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/fzf-preview.sh b/bin/fzf-preview.sh index 82c0b25b..fe405ef1 100755 --- a/bin/fzf-preview.sh +++ b/bin/fzf-preview.sh @@ -2,6 +2,10 @@ # # The purpose of this script is to demonstrate how to preview a file or an # image in the preview window of fzf. +# +# Dependencies: +# - https://github.com/hpjansson/chafa +# - https://github.com/sharkdp/bat file=$1 type=$(file --mime-type "$file") @@ -23,8 +27,8 @@ elif [[ $KITTY_WINDOW_ID ]]; then # you have to use 'stream' kitty icat --clear --transfer-mode=memory --stdin=no --place="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0" "$file" | sed \$d echo -en "\e[m" -elif [[ -n $FZF_PREVIEW_PIXEL_WIDTH ]]; then - convert "$file" -resize "${FZF_PREVIEW_PIXEL_WIDTH}x${FZF_PREVIEW_PIXEL_HEIGHT}>" -dither FloydSteinberg sixel:- +elif command -v chafa > /dev/null; then + chafa -f sixel -s "${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file" else file "$file" fi |
