Open piechologist opened 3 weeks ago
Thanks- I wanted to test this myself in kitty - but I cannot see the response sequence that kitty sends back - do you know where that is actually written to? I tried out read(stdin)
after plotting something but it does not look like its written to Julia's input stream.
Yeah, not all terminals do it the same way. For instance, Ghostty prints the response but WezTerm does not. AFAIK, some terminals don't even send a response at all.
You can put the terminal into raw mode. I think the best way is the following code from TerminalExtensions.jl:
using REPL: Terminals
function foo()
term = Terminals.TTYTerminal("xterm", stdin, stdout, stderr)
Terminals.raw!(term, true)
Base.start_reading(stdin)
write_kitty_image_escape_sequence(stdout, # ... your request here
data = readuntil(stdin, "\e\\") # read the response up to ST (the string terminator)
return data
end
BTW, thank you for this extension! I use SixelTerm.jl with WezTerm but I think the Kitty protocol is the way to go.
Added parameter
q=1
to the draw requests. The terminal won't respond with an escape sequence that we don't read anyway.The Kitty graphics protocol requires the terminal to send a confirmation in form of an escape sequence (see here). KittyTerminalImages.jl does not capture the response so, something like
_Gi=1234;OK\
may leak into the following Julia prompt in some terminals (I'm currently beta-testing Ghostty). The quiet mode solves this issue.