wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.29k stars 718 forks source link

termwiz in the web #181

Open segeljakt opened 4 years ago

segeljakt commented 4 years ago

I have published a crate named xterm-js-rs which leverages bindings to the xterm-js Javascript library. With it, you can implement web-based terminals running at the client-side in WebAssembly.

You can see an example of it in action here: https://segeljakt.github.io/xterm-js-rs/

The source code for the example can be viewed here also: https://github.com/segeljakt/xterm-js-rs/blob/master/example/src/lib.rs

Would you be interested in adding a backend for web-based terminals?

segeljakt commented 4 years ago

(Missclick)

wez commented 4 years ago

Thanks for reaching out! I think there are a couple of interesting directions that could be taken in that space:

I'm open to seeing something happen in either or both areas, but I personally lack the time to own that effort or to really dig in and become an expert with web assembly in order to maintain it. I will happily discuss design considerations and review PRs in this area if you (or someone else!) has the bandwidth to own and drive that work for a while to get it in a good place. I will be looking to make sure that PRs in that area have sufficient automated test coverage that they don't regress because I'm concerned about supporting a feature set in an unfamiliar area!

segeljakt commented 4 years ago

Thank you for the response, I am not so good at frontend development but I think I could help out with the first option. From what I recall, xterm-js has most of what the Terminal trait requires, but I need to check how the raw and cooked modes are handled.

Compiling to WebAssembly is in my experience not too tricky as long as the program does not depend on OS-specific things like IO and paths. By conditionally compiling to Windows and Unix already, WebAssembly support is hopefully as easy as adding another target.