logoalt Hacker News

Ghostty compiled to WASM with xterm.js API compatibility

269 pointsby kylecarbsyesterday at 6:17 PM86 commentsview on HN

Comments

clintoncyesterday at 10:49 PM

Curious to know what makes this "a proper VT100 implementation in the browser, not a JavaScript approximation of one" -- isn't Ghostty also an approximation, just implemented in a different language? Seems unnecessarily pejorative to me.

show 2 replies
mitchellhyesterday at 7:30 PM

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!

show 1 reply
syrusakbaryyesterday at 10:47 PM

I've set up an online demo using Wasmer for local execution, so everyone can try easily! (try typing `cowsay hello`):

https://ghostty-web.wasmer.app/

How to try it locally:

  npx @ghostty-web/demo@next # The preferred way
  # OR 
  wasmer run wasmer/ghostty-web

  -> Go to http://localhost:8080/
Source code: https://github.com/wasmerio/webassembly.sh (updated from xterm into ghostty-web without any issue!)
show 2 replies
tuananhtoday at 3:06 AM

I'm just here to say coder is great! We love it. Thanks @kylecarbs and the team.

show 1 reply
someguy101010yesterday at 7:16 PM

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!

show 1 reply
jxdxbxyesterday at 11:48 PM

Ghostty is so great. Cross-platform but native on Mac and Linux. Core written in a cool random language, showing that you can have well-behaved Mac apps that aren’t just pure Swift / Objective C. Same great design no doubt helps here.

show 2 replies
VikingCoderyesterday at 7:59 PM

So, could someone now make a Visual Studio Code (and specifically code-server) that has ghostty-web as the Terminal?

show 1 reply
indemnityyesterday at 8:08 PM

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.

show 3 replies
aidenybtoday at 1:20 AM

This is great. I've been using code-server to embed VSCode into the browser and been missing the terminal functionality. Excited to try this out.

jordemortyesterday at 9:22 PM

Hm, might try hacking this into https://tsl0922.github.io/ttyd/

show 1 reply
quantummagictoday at 12:49 AM

Is there any way for Ghostty to grab all keystrokes? It's a bit of a drag to type ctrl-w inside of Vim, and have the entire browser-tab close ;-)

show 1 reply
thoughtfulchrisyesterday at 10:49 PM

This is super cool! I'm close to releasing a project to make Ink work in the browser for building cross-platform terminal apps. (Ink is what Claude Code / Gemeni CLI use for rendering.)

Currently it uses Xterm.js - but I'll have to try swapping Xterm out for ghostty-web!

show 2 replies
solotronicsyesterday at 10:54 PM

I always thought it would be interesting in backend systems to catch a certain exceptions and auto-generate a link to a shell. Given the proper authentication is implemented would this be a good tool to achieve that "remote debug" shell?

warunslyesterday at 9:19 PM

I have no understanding of any of this except that Ghostty is an alternative to iTerm2. Can someone do a ELI5 for the uninitiated?

show 4 replies
gregsadetskytoday at 12:27 AM

Hey all, you can try ghostty-web here:

https://ghostty.ondis.co/

Stellar work, Kyle! Cheers

show 1 reply
neomantratoday at 12:35 AM

I have been looking for this for a while — thank you for making it! I’m gonna explore how I can deploy my BubbleTea TUI’s with it.

joshkatoday at 1:19 AM

Neat. Would be cute to see this in VSCode to replace the terminal there...

asadmyesterday at 9:17 PM

can you do a hosted demo with jslinux (or similar) as backend? https://bellard.org/jslinux/

show 1 reply
vadepaysayesterday at 10:04 PM

This is fantastic. Under MIT even! Thank You!

oerstedyesterday at 8:20 PM

Does this version support custom GPU shaders? I have been looking for a command-line with cool-retro-term aesthetics that can run in the browser for a while.

show 1 reply
jumploopsyesterday at 8:14 PM

Oh man this is awesome. Recently integrated xterm.js on a new project and was frustrated with the limitations. Great work!

show 1 reply
riddleyyesterday at 11:15 PM

Someone finally figured out how to make it work under Linux!

show 1 reply
pmarreckyesterday at 8:38 PM

omg! Seriously, wow. That was quick! Only just heard that Hashimoto libbed out his terminal the other day and remarked about how smart that was... And it made this possible

shortlivedyesterday at 10:25 PM

Do we have Windows support yet?

show 1 reply
ivanjermakovyesterday at 8:11 PM

No hosted demo?

show 1 reply
sigmonsaysyesterday at 9:41 PM

but why?

show 1 reply