Added untested support for iterm2 image rendering
This commit is contained in:
parent
c2612b8d8c
commit
7e042c4b5a
23
fetch
23
fetch
|
@ -184,6 +184,11 @@ image="wall"
|
||||||
# Thumbnail directory
|
# Thumbnail directory
|
||||||
imgtempdir="$HOME/.fetchimages"
|
imgtempdir="$HOME/.fetchimages"
|
||||||
|
|
||||||
|
# Image Backend
|
||||||
|
# Which program to draw images with
|
||||||
|
# --image_backend w3m, iterm2
|
||||||
|
image_backend="w3m"
|
||||||
|
|
||||||
# W3m-img path
|
# W3m-img path
|
||||||
# Some systems have this in another location
|
# Some systems have this in another location
|
||||||
w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
|
w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
|
||||||
|
@ -1112,6 +1117,7 @@ usage () { cat << EOF
|
||||||
Image:
|
Image:
|
||||||
--image Image source. Where and what image we display.
|
--image Image source. Where and what image we display.
|
||||||
Possible values: wall, shuffle, /path/to/img, off
|
Possible values: wall, shuffle, /path/to/img, off
|
||||||
|
--image_backend Which program to use to draw images.
|
||||||
--shuffledir Which directory to shuffle for an image.
|
--shuffledir Which directory to shuffle for an image.
|
||||||
--font_width px Used to automatically size the image
|
--font_width px Used to automatically size the image
|
||||||
--image_position Where to display the image: (Left/Right)
|
--image_position Where to display the image: (Left/Right)
|
||||||
|
@ -1203,6 +1209,7 @@ while [ "$1" ]; do
|
||||||
|
|
||||||
# Image
|
# Image
|
||||||
--image) image="$2" ;;
|
--image) image="$2" ;;
|
||||||
|
--image_backend) image_backend="$2" ;;
|
||||||
--shuffledir) shuffledir="$2" ;;
|
--shuffledir) shuffledir="$2" ;;
|
||||||
--font_width) font_width="$2" ;;
|
--font_width) font_width="$2" ;;
|
||||||
--image_position) image_position="$2" ;;
|
--image_position) image_position="$2" ;;
|
||||||
|
@ -1335,9 +1342,19 @@ colors
|
||||||
bold
|
bold
|
||||||
printinfo
|
printinfo
|
||||||
|
|
||||||
[ "$image" != "off" ] && \
|
if [ "$image" != "off" ]; then
|
||||||
printf "%b%s" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
case "$image_backend" in
|
||||||
$w3m_img_path
|
"w3m")
|
||||||
|
printf "%b%s" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
||||||
|
$w3m_img_path
|
||||||
|
;;
|
||||||
|
|
||||||
|
"iterm2")
|
||||||
|
base64="$(printf "%s" "$img" | base64)"
|
||||||
|
printf "%b%s" "\e[1337;File=width=${imgsize}px;height=${imgsize}px;inline=1:${base64}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
# Move cursor to bottom and redisplay it.
|
# Move cursor to bottom and redisplay it.
|
||||||
if [ "$clear_terminal" == "on" ]; then
|
if [ "$clear_terminal" == "on" ]; then
|
||||||
|
|
Reference in New Issue