SSH is a GUI framework

(zydra.sh)

76 points | by teledream 4 days ago

15 comments

  • orbital-decay 1 hour ago
    Terminal giving you a janky and limited remotely accessible canvas you can abuse to make primitive GUIs doesn't imply that "SSH is a GUI framework".

    A lot better solution would be designing a compact, semantic, styling-independent remote access protocol that doesn't need bitmaps (unlike most currently available protocols), and uses good compression for actual pictures/videos. That would make any GUI efficiently usable remotely through an adapter, without extra bloat the browser has.

    • rpcope1 48 minutes ago
      So basically expanding on remote X11/X forwarding?
      • orbital-decay 44 minutes ago
        X forwarding is the complete opposite of that - it's non-semantic, doesn't abstract away styling, heavily relies on bitmaps, and generally a lot noisier than a terminal. It needs to be replaced with something better thought out for GUI remote access to be a viable alternative. Same goes for SPICE (as far as I remember how it works).
        • wahern 12 minutes ago
          The X protocol is semantic[1] and when used as originally intended is very fast even on 1990s networks. But GUI toolkits ended up heavily relying on local rendering and shipping bitmaps over the wire, which is why Wayland advocates argued bitmaps are good enough.

          It's kinda like the way PostScript evolved into early PDF which evolved into modern PDF, where pages are basically assemblies of prerendered images. The original, semantic aspects are still there, just not used, or rather abused to dumb it down.

          [1] At least in the way you mean. Semantic like SVG, which is still literal, just abstract.

    • teledream 35 minutes ago
      I mean, one could argue that the web is just a remotely accessible hypertext protocol we've been increasingly abusing to make whatever arbitrary GUIs we want.

      I've always wanted a styling-independent protocol, which led me to the Gemini protocol (not the AI) for one, although I find that all such "next-generation" protocols don't see much traction.

      I picked SSH as a convenient option that people already use to log into VMs.

    • XorNot 28 minutes ago
      The problem is a web browser is exactly that use case. Their whole function is to remotely render a GUI.

      We gripe about web design when people start to act more like it's local, but all the things a browser does are essentially "I need a remote GUI" and a lot of effort has gone into that.

      • icedchai 14 minutes ago
        A terminal with an HTML/CSS embedding mode would be interesting.

        In the BBS days, there were some attempts to move beyond ANSI escape sequences, like RIPscrip: https://en.wikipedia.org/wiki/Remote_Imaging_Protocol

        Once the web took off, all that stuff disappeared...

      • zokier 18 minutes ago
        it is annoying how poorly web browsers support the local or ssh tunneled application use case though. it would be nice if there was a way to get browsers to work more like X servers, presenting an unix socket that applications (either local or ssh-tunneled) could connect to. Or something along those lines.
    • kccqzy 28 minutes ago
      That better solution is known as plain HTML over HTTPS. The user can write their own styles. The user can prohibit <img>s or selectively allow them.

      But yeah the author is probably deliberately conflating between the Terminal which renders and the SSH protocol which just transports streams securely. It makes the title more enticing.

    • ireadmevs 38 minutes ago
      I'd propose we define some kind of hypertext markup language. Probably allowing the app send some default cascading style sheets would not be bad, but we should be able to apply our custom ones over it. Then we find a way to represent our state transfers between the client and server.
    • bflesch 54 minutes ago
      how does hyper gui transfer protocol sound? :)
      • Exoristos 46 minutes ago
        How it sounds depends on how you pronounce GUI--do juniors say "gooey," or has that passed away with "sequel" and "clee"?
  • nico 1 hour ago
    I remember my college used to serve some student services app via Telnet

    You would just telnet into a machine using your student login/pass, and it would run either a welcoming screen or a specific app (like one for scheduling classes)

    It was a very mature application and worked really well. Alas, it was quickly replaced by web versions of the apps, which took another flew years to get properly working

    Anyway, glad to see an example of what’s possible (and almost forgotten), in terms of providing access to applications online via the terminal (and without a browser)

    • Telemakhos 53 minutes ago
      I remember those days, and getting mail by telnet. I wonder what would happen if you asked college kids to ssh in to a server today instead of giving them a web interface. I think it could be a big plus for them to see some sort of computing that isn't packaged the same way as everything else, namely as a web page.
  • Sha1rholder 1 hour ago
  • alex7o 1 hour ago
    I thought that this would be about x11 forwarding but this is also pretty cool
    • teledream 1 hour ago
      Thanks :)

      I do really like x11 forwarding, but unless you're on Linux, you'd need to download an X server, so I thought this would be interesting as something anyone could try from almost any machine.

    • k0dyn 51 minutes ago
      Me too - my initial thought was "Ooh, did someone just discover the -X flag?"

      But nope, now I'm feeling old again.

  • goranmoomin 58 minutes 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

    • teledream 42 minutes ago
      "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.

      • myaccountonhn 8 minutes ago
        How about just a website you serve over wireguard? Can even be turned into a tui with w3m
  • rvz 1 hour ago
    I don't think this makes any sense, as ssh isn't suited for this use-case.

    It also doesn't make much sense to bring all the security problems that exists in web browsers into a terminal delivered via SSH because you want to render special escape codes such as kitty or even sixel that make it possible to achieve remote code execution in someone's terminal. [0]

    Absolutely no thanks.

    [0] https://ii4gsp.github.io/iterm2-rce/

    • teledream 56 minutes ago
      That's a fair concern. Any escape-sequence parser can have unknown vulnerabilities, and terminals don't have browser-grade sandboxing. Still, it's quite a different, much smaller attack surface than a browser downloading and running untrusted client-side code (JS, WASM), and a much easier one to harden over time.
  • qurren 1 hour ago
    eeh using sixel or other sub-character graphics to render a GUI isn't really a feature of ssh. It's just a terminal feature, you could do it with telnet.

    also related: i created a tool to show ROS topics over a terminal, intended for people debugging robots over ssh: https://github.com/dheera/rosshow

    For better compatibility I used Braille characters to render a 2x4 grid per character, not sixel.

    • teledream 1 hour ago
      Braille is really interesting as something more universal. Cool project.

      It's true, SSH is just the tool of choice to move bytes around, and it's up to your terminal emulator and the server to decide what those bytes mean. In practice, SSH gives you encryption, key auth, and a way past restrictive firewalls (we listen on port 443 for this exact reason).

  • messh 17 minutes ago
    [dead]
  • st_goliath 1 hour ago
    > SSH is a GUI framework

    By that logic, TLS is a web browser.

    I was originally going to quip that by the articles logic, VNC should be a GUI framework too, but it is actually mentioned in the article. However, the text under the headline goes weirdly off the rails talking about webkit, WASM and WebGPU.

  • daylily 32 minutes ago
    I'll try to pick apart this paragraph in specific:

    > While webapps have advantages, especially in client-side state, WASM, and WebGPU, they don't really capture the universality and ease-of-use of an SSH session. SSH keys double as authentication, and -A allows you to SSH into servers from within a remote microVM itself. Webapps also can't be accessed from a pure TTY.

    > SSH keys double as authentication

    Which is true! They are also typically associated with more than one service so rotation is a lot more painful.

    > and -A allows you to SSH into servers from within a remote microVM itself

    You can, indeed, also run a proxy on a remote VM and then access a web application via that VM! I don't think there's a practical distinction here.

    > Webapps also can't be accessed from a pure TTY.

    ...And which tty would be able to render those special escape sequences without going through a terminal emulator?

    I'll stay on the web.

  • lnxsxu 53 minutes ago
    ok so wayvnc already gets told by the compositor which parts of the screen changed. being able to select the terminal text is cool. did i miss the bandwidth and input lag numbers for the same workload at the same image quality or did we just skip straight to “beats vnc”?
    • teledream 19 minutes ago
      I'm not necessarily saying SSH wins on a raw codec benchmark against wayvnc (I'd be glad to test it though, and I am working on a faster native client).

      It's that the whole workflow has been built around SSH. I haven't just bolted a VM's "display_1920x1080" onto a Kitty stream and called it a day. Here I have a microVM that in and of itself renders natively to SSH, bringing with that SSH's key auth, and a universal client you can run on any terminal (with a text-only fallback).

      Put simply, I don't enjoy remotely streaming a clunky desktop display, even if it's technically "fast". SSH feels at home, and that's why I built desktop VM infra on it natively.

  • daylily 1 hour ago
    Really doesn't seem like it would have great accessibility, but I suppose that ship has sailed with the proliferation of TUIs.
    • Eduard 55 minutes ago
      as if CLIs were designed for general accessibility
      • daylily 51 minutes ago
        I think they are? They (mostly) output a stream of text where the order of the text matches the structure of the underlying information.

        TUIs with their box-drawing characters and emulated 2-d layouts, on the other hand, are not. I think Claude Code really set a bad example here that got everyone interested in making TUIs again.

      • munk-a 44 minutes ago
        They are. Text based interfaces are the easiest to transform into other media - accessible and pretty aren't the same thing.
  • cozzyd 51 minutes ago
    Apparently there are some brain-damaged terminals (e.g. warp) that instead of using normal ssh launch some remote helper process that opens one worker thread per core that all wake up at the same time. Which is great fun on a 192 core shared systemm. Fortunately a cgroup task/cpu limit will neuter them and other abusive programs like vscode-server.
  • arjunghose10 44 minutes ago
    [flagged]
  • amelius 38 minutes ago
    makes me wonder: if a tool can do almost everything then doesn't that mean its attack surface is also unnecessarily large?