Ttyd – Share your terminal over the web
4 comments
·March 23, 2025pcwelder
Thanks for sharing this.
I got curious and I wondered if a similar thing could be done using pexpect.
I went ahead and asked claude to create an MVP. Works pretty well for 20 mins worth of work. Pexpect is a great tool imo.
If anyone is curious: https://github.com/rusiaaman/pexpect-web
aesh2Xa1
I think a better description is "ttyd allows you to use your web browser as a terminal emulator." The sharing part is what struck me. I think of that as multiplexing, and you'd still need tmux, screen, Zellij, etc.
There actually is a tmux fork, tmate, that shares over the Internet (not web/HTTP).
Anyway, this looks great. They mention OpenWrt, and that's exactly what I'd use it for.
sam_lowry_
There is also screen -x to share the terminal
One issue I always run into with browser-based terminal emulators or remote desktop clients is that common keyboard shortcuts like Ctrl-W might be used by the browser instead. Accidentally closing your browser tab and thus losing all your state when you just wanted to remove the previous word is quite annoying. It could be nice if a web app was able "capture" the keyboard somehow so that the browser doesn't react to any of its normal shortcuts, which is also commonly done in VM software and remote desktop apps, or I guess similar to input mode in Vim.
An open issue here[1] mentions that PWAs can actually define shortcuts that override browser ones which could be a solution. And someone also mentions using extensions that redefine the Ctrl-W shortcut as a workaround. But afaik both of these solutions rely on defining keyboard shortcuts beforehand which doesn't seem easy to do, given that you'd have to somehow define all of the shortcuts possibly used by your shell, editor, or any other terminal apps.
[1] https://github.com/tsl0922/ttyd/issues/1181