Ghostty compiled to WASM with xterm.js API compatibility
55 points
1 hour ago
| 4 comments
| github.com
| HN
indemnity
2 minutes ago
[-]
Oh damn, this is awesome.

I wonder if https://github.com/zed-industries/zed/discussions/18129 is still accurate. Would love to be able to use Ghostty as my Zed terminal.

reply
someguy101010
54 minutes ago
[-]
nice one kyle! you could add https://github.com/wasmerio/webassembly.sh and have a fully featured in browser shell with support for installing packages!
reply
kylecarbs
51 minutes ago
[-]
I'll do this for a much improved demo!

Currently you need the command-line to try it, which is an unfortunate UX.

reply
syrusakbary
18 minutes ago
[-]
This is awesome! I'm Syrus, from Wasmer. Would love to help you with this!

We are releasing soon a new version of wasmer-js, so it should be very easy to use it with webassembly.sh (note webassembly.sh and wasmer.sh share the same code)

https://github.com/wasmerio/wasmer-js/tree/main/examples/was...

reply
kylecarbs
15 minutes ago
[-]
Neat. I'll take a look. Thanks Syrus!
reply
VikingCoder
11 minutes ago
[-]
So, could someone now make a Visual Studio Code (and specifically code-server) that has ghostty-web as the Terminal?
reply
kylecarbs
4 minutes ago
[-]
Yup, that's the idea!
reply
mitchellh
39 minutes ago
[-]
Holy shit Kyle. I had no idea you were working on this. This is amazing. Your patch is also very instructive on what you need me to do for you to make this more reasonable.

I'm guessing that performance of this relative to xterm right now isn't... the best, mainly because the way you're grabbing the viewport seems expensive. I'm curious though if you did any benchmarks?

One thing you probably really want to expose is the new RenderState API: https://github.com/ghostty-org/ghostty/blob/main/src/termina... You're doing per row line grabbing currently which is probably pretty slow. The RenderState API is stateful and produces the state necessary to create a high-performance, delta update renderer. It's what our production GPU renderers are now built on (but the API itself is compatible with any kind of renderer). It'd be better for you.

After all that, I'm very curious even at this rudimentary level what the performance on various benchmarks look like compared to xterm.js.

Excellent work!

reply
kylecarbs
33 minutes ago
[-]
We spent little time on performance so far, this is more of a POC that will hopefully become a drop-in replacement for xterm.js over time.

I'll swap it over to the new RenderState API and post some benchmarks!

Many kudos to y'all, we were shocked how simple it was to hack this together.

reply