Eugeny / tabby

A terminal for a more modern age
https://tabby.sh
MIT License
58.31k stars 3.35k forks source link

Support IMG Preview like iTerm2 #5687

Open Rhythmicc opened 2 years ago

Rhythmicc commented 2 years ago

Describe the solution you'd like

Protocol

iTerm2 extends the xterm protocol with a set of proprietary escape sequences. In general, the pattern is:

ESC ] 1337 ; key = value ^G

Whitespace is shown here for ease of reading: in practice, no spaces should be used.

For file transfer and inline images, the code is:

ESC ] 1337 ; File = [arguments] : base-64 encoded file contents ^G

The arguments are formatted as key=value with a semicolon between each key-value pair. They are described below:

Key |   | Description of value -- | -- | -- name |   | base-64 encoded filename. Defaults to "Unnamed file". size |   | File size in bytes. The file transfer will be canceled if this size is exceeded. width |   | Optional. Width to render. See notes below. height |   | Optional. Height to render. See notes below. preserveAspectRatio |   | Optional. If set to 0, then the image's inherent aspect ratio will not be respected; otherwise, it will fill the specified width and height as much as possible without stretching. Defaults to 1. inline |   | Optional. If set to 1, the file will be displayed inline. Otherwise, it will be downloaded with no visual representation in the terminal session. Defaults to 0.

The width and height are given as a number followed by a unit, or the word "auto".


roobscoob commented 2 years ago

bump, especially regarding SVGs. would massively help my use-case