Hacker News new | ask | show | jobs
by goranmoomin 7 days ago
Before we start abusing the terminal protocols for GUIs, I believe that we need some kind of protocol to allow text selection and copy/paste between blocks of text, so that we don't need tools that trim whitespace that was copied from the terminal[0].

There's some prior work like how the OSC-8 hyperlink id param[1], and a specification to tackle the issue[2].

I'm hoping that the Superlogical folks[3] can actually do this, in libghostty and Rex.

But also in tangent, I also do think that abusing the terminal protocol to do GUI stuff is kind of a worse-is-better type of situation, we specifically have a protocol (Wayland, Quartz, and so on) to do this stuff, and I'm hoping that we can decide to actually do something similar for the remote GUI situation. I believe that the Superlogical folks have plans to do this with Rex[4].

I believe that the remote-GUI situation has to be resolved, I've been talking about this multiple times. I thought that the web stack (HTML/CSS/JS) would be the answer to adoption[5], but hopefully we can get a full-fledged solution that is compatible with the previously existing GUI apps as well.

> - TUIs are not inherently superior to GUIs

> - SSH, as a transport layer, should support not just forwarding a pty (as a TUI display layer), but a GUI display layer as well

> In fact, these two arguments were already realized by UNIX 30 years ago, and we already have one solution: the X protocol and ssh -X.

> Unfortunately, X did not win out. We did not get the promised future where one can ssh -X into a remote machine, run gnome-control-center, and a settings window pops up and I can configure my remote computer. (If you believe that this works, try it out yourself. It is an abysmal experience.)

> However the above needs still needed to be satisfied by so much people, and apps that needed it started to be developed as web servers, stuff like jupyter notebooks. It turns out that the web’s document format coupled with a styling solution and a client-side scripting language, with all of its warts and drawbacks, became a viable solution as a display layer for interactive apps. In fact, since it started from remote documents, network transparency is built-in.

> It would be dumb to not realize that the HTML/CSS/JS stack did win a dominant position for desktop apps, with all of the Electron apps, and utilize the web as a display layer for the above. I see the project in a similar vein, i.e. utilizing HTML/CSS/JS to provide a display layer for remote apps via SSH.

> Also note that Electron apps has the same split with X, where the display server and the client are separated: it's called the "renderer process" and the "main process", and the two processes talk via IPC (where the display server would be the renderer process running embedded Chromium, the display client would be the Electron main process, and the stuff that the client sends to the server would be the contents of the renderer JS bundle). I think, theoretically, it would be possible to run the main process separated from the renderer process on a different machine, with an appropriate IPC transport. I think this would be not far from the above idea?

[0]: https://tools.simonwillison.net/cleanup-claude-code-paste

[1]: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3c...

[2]: https://gitlab.freedesktop.org/terminal-wg/specifications

[3]: http://superlogical.com/

[4]: https://www.superlogical.com/rex/

[5]: https://news.ycombinator.com/item?id=48728766

1 comments

"Worse-is-better" is really perceptive. Using SSH as a GUI is admittedly a dirty solution, but I find it practical. See, if I tried to build a cross-platform app supporting X11, Wayland, Windows, and macOS, then I'd really be making a GUI framework, and if I tried to abstract all of those universally, well, I'd still be making a GUI framework. Thus the case for SSH presents itself.

That said, current terminals definitely have rough edges. Being somewhat "dumb" clients keeps the attack surface smaller, but it's also quite limiting. To address this (while keeping standard terminals working), I've been working internally on a prototype terminal client to hopefully get things smoother, which I'll share updates when it's ready, along with any open-source projects that come out of the infrastructure it needs.

I heard of Superlogical whilst initially working on Zydra, though I somehow missed the release of Rex, it's definitely something I'll have to look into.

Thanks for such a thoughtful comment.

It's a fun experiment but I would never do this. You lose all the magic of "just ssh hostname" when you only work properly with a few terminal emulators. Rolling your own terminal emulator is an extra step in the wrong direction.

On the flip side, cross-platform GUI frameworks already exist. HTML+CSS are really great, with everything you need and more built-in already, and none of the jank running in a 1970s-based terminal brings. If you want reduced attack surface I would say it makes more sense building (or forking) a browser engine with just the features you need, keeping compatibility with other browsers so nobody is forced to use yours.

Kitty is only the first-class option; Sixel and iTerm2 are available, and even in text-only terminals (or a TTY), we stream the entire GUI as ASCII (like a TUI), and you still get the other features. "Just ssh hostname" remains.

And we actually do have a webapp too, and it's alright, but I prefer SSH. To me, the project is more of a "multiplexer-on-steroids" with a built-in microVM to hold its apps and graphics, rather than a simple remote desktop. You wouldn't run a multiplexer over the browser just because it technically has everything built-in.

In the case of VNC/other protocols, there is an asymmetry: if you embed text in VNC, it still has to be streamed as graphics, whereas if you embed graphics in SSH, you can still stream text as actual text.

Fun fact: Our webapp does stream many elements as HTML (including even Wayland apps) rather than just streaming them using a codec.

Right. Your product is designed to be like a multiplexer, and that's a concept that only exists in terminals, so it makes sense for your product.

> whereas if you embed graphics in SSH, you can still stream text as actual text.

I agree with you here that remote desktop sucks but, honestly, terminals suck too. They both make different tradeoffs to accomodate graphics at the expense of text, or text at the expense of graphics. With something like HTML+CSS you don't compromise on either because it has first class support for both text and media.

I highly recommend that you give Claude (desktop, not the TUI, make sure you use Code in it) a try because it is a much better experience IMO. You have a GUI chat with nice text rendering, selectable/dictatable, and mixed media into it. And you have panels for things like your diffs, terminal, and browser to see what it's building. Basically what you've built except runs locally, which goes against what you're building, but it is a good example of what you could build by ditching the terminal.

beep beep meow meow
How about just a website you serve over wireguard? Can even be turned into a tui with w3m