feat: improved image quality
This commit is contained in:
parent
adaff4e285
commit
a9e6bbd878
@ -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 [ "$type" != "image" ]; then
|
||||
cat <<EOF >"$photo"
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="1pt" height="1pt" viewBox="0.00 0.00 1.00 1.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
|
||||
EOF
|
||||
fi
|
||||
WIDTH=30
|
||||
if [ "$FZF_PREVIEW_COLUMNS" -lt "$WIDTH" ]; then
|
||||
WIDTH="$FZF_PREVIEW_COLUMNS"
|
||||
fi
|
||||
$CHAFA -f symbols -s "$WIDTH" "$photo"
|
||||
$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"
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user