ttyd icon indicating copy to clipboard operation
ttyd copied to clipboard

Better support for Sixel especially with tmux etc.

Open gwpl opened this issue 10 months ago • 1 comments

Is your feature request related to a problem? Please describe.
I’m trying to display Sixel images in a browser using ttyd with a tmux session. Despite setting enableSixel=true, the images do not render correctly and are instead displayed as "+++" checker patterns. This works fine in the "Konsole" terminal when I set export TERM=xterm-256color inside tmux, but not in the browser.

Describe the solution you'd like
I’d like ttyd to properly render Sixel images in the browser when connected to a tmux session, similar to how they display in "Konsole". Ideally, it should handle Sixel output correctly without additional workarounds beyond enableSixel=true.

Describe alternatives you've considered

  • Setting export TERM=xterm-256color inside the tmux session (works in Konsole but not in the browser).
  • Adjusting tmux and ttyd settings without success.
  • Testing different browsers, but the issue persists.

Additional context
Originally mentioned this in (https://github.com/tsl0922/ttyd/issues/1248#issuecomment-2652275342), but couldn’t reopen it. Reposting here to ensure visibility.

Command used to start ttyd:

ttyd -t enableSixel=true -p 51515 -c abc:123 tmux a -t WEBTERM

Example of incorrect output in the browser:

SIXEL IMAGE (26x10) ++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++
++++++++++++++++++++++++++

For comparison, using viu (https://github.com/atanunq/viu) works as expected in "Konsole".

gwpl avatar Feb 11 '25 23:02 gwpl

SIXEL IMAGE is tmux's sixel fallback.

There is a potential fix in tmux 3.6 https://github.com/tmux/tmux/issues/4099

I checked xterm.js responds.

~ via 🐍 v3.12.9 via ❄️  impure (nix-shell-env) 
❯ python termpixel.py                      
Querying terminal for window pixel dimensions (CSI 14t and 18t)...
Received response for CSI 14t: '\x1b[4;1440;1880t'
Parsed pixel size: width=1880px, height=1440px

~ via 🐍 v3.12.9 via ❄️  impure (nix-shell-env) 
❯ 

Just to see what would happen, I took those pixel values, manually set TIOCSWINSZ and launched tmux

Image

haodeon avatar May 09 '25 03:05 haodeon