Live data from Hacker News

Things I've learned building a modern TUI Framework (2022)

textualize.io

101–110 of 127 posts

Re: Things I've learned building a modern TUI Framework (2022)

#101

Why do software engineers care so much about TUI? I really don't get it. I love a good command line program. But TUI just doesn't appeal to me.

I like TUIs because they are usually the exact opposite of the large range of UX fashions that absolutely suck, and have infected every other GUI app and website I use. The terminal is a breath of fresh “I’m not going to treat you like a moron” “more is more” “you’ll know if it’s a button” high contrast air.

Re: Things I've learned building a modern TUI Framework (2022)

#102

Why do software engineers care so much about TUI? I really don't get it. I love a good command line program. But TUI just doesn't appeal to me.

There isn't much obvious benefit in using TUIs, but writing TUIs has a big upside: it's easier in most ways. It's trivially cross-platform, you don't have to make pixel-perfect GUIs (because it's impossible), you don't need icons or graphics (because you can't show graphics), etc.

That's the main reason. TUI programs can be created quickly, and they're mostly developer-oriented, so they just need to be useful enough and don't need to be optimized as much as a GUI program.

Re: Things I've learned building a modern TUI Framework (2022)

#103
post #100

Many people here mention SSH as one motivating uses for TUIs. It's a shame that we don't have standardized HTTP forwarding over SSH that would work as seamlessly as X forwarding can work.

We have -L though, isn't that kind of what you're looking for?

Re: Things I've learned building a modern TUI Framework (2022)

#104
post #97
post #94

Earlier quoted context omitted.

Because I don't need a resource-heavy GUI for something as simple as a music player.

GUI is not intrinsically any more resource-heavy than TUI; ultimately you need to render stuff on screen somehow and get user input, and going through tty layer just is extra bloat.

It isn't extra bloat when you are already using that layer for other things and also doesn't require any extra packages or connections on your side of things.

Specifically when dealing with remote environments where you connect to through ssh anyway it is really awesome when some things can be done through a nice TUI. In that context a GUI would actually be more resource heavy considering that it likely will be web based with much more client side processing happening for the GUI.

Re: Things I've learned building a modern TUI Framework (2022)

#105

Earlier quoted context omitted.

Are there any libraries in place which can normalize all emojis down to a single symbol?

It doesn't matter; what matters is that both your (terminal-manipulating) program and terminal emulator agree on the symbols widths. Considering that they usually won't (lots of terminal emulators have their own hand-crafted, statically linked wcwidth/wcswidth functions; the readline library also has them hard-coded, by the way), it's quite frustrating.

This.

Re: Things I've learned building a modern TUI Framework (2022)

#107
post #65

Earlier quoted context omitted.

I don't agree that React is FRP. FRP is a generic solution that builds data-UI synchronization around data, and assumes that incremental UI updates will be written in UI code. React puts data-UI synchronization code inside UI components and provides an Immediate Mode-like API to avoid writing incremental updates in UI code.

In your world, the incremental UI code lives in the react library, and react applications aren’t UI code, they’re just FRP data transformations.

React components are clearly not FRP data transformations, they don't have any notion of data flows, observable/computed values, etc.

Re: Things I've learned building a modern TUI Framework (2022)

#108
We use Textual as an interactive way to explore compilation pipelines in xDSL [0]. As our compiler is written in Python, it was the perfect tool to build a UI in the same language as the existing codebase. After starting the `xdsl-gui` project, we found Marimo [1], a reactive notebook for Python, which also lets users build apps in Python. It's been interesting to compare these two, especially in the way they handle state and propagate updates. For now we're using both tools, but it might make sense to centralise at some point. Both of these frameworks like immutable data structures, which I find is a positive incentive to use immutability throughout the code, and has been good for the rest of the project.

[0]: https://xdsl.dev/ [1]: https://marimo.io/

Re: Things I've learned building a modern TUI Framework (2022)

#109
post #100

Many people here mention SSH as one motivating uses for TUIs. It's a shame that we don't have standardized HTTP forwarding over SSH that would work as seamlessly as X forwarding can work.

We have -L though, isn't that kind of what you're looking for?

Common ssh (port) forwarding has lots of shortcomings that make it far less practical than X forwarding for this sort of use.

Sketching out this idea, what I'd want is that ssh would set some standardized env var pointing to unix socket (analogous to $DISPLAY), and applications when starting up should pick that up. That should trigger applications to start listening on another unix socket (instead of tcp port), and notify ssh through the socket pointed by the env var. Upon that notification, ssh should set up new tunnel and open new browser window pointing to the tunnel.

Nothing about that is technically particularly difficult (I'd say its almost trivial), but it'd need standardization to be truly useful.

Re: Things I've learned building a modern TUI Framework (2022)

#110
Is there any terminal, that throws out all the stone age terminal stuff, like weird codes for starting colored output and stopping colored output? A terminal, that instead makes use of some XML tags or so, to mark text in a readable fashion as prompt, input, output, maybe variables and such, colored and non-colored, etc., and then simply has some logic to render that XML correctly?

Of course that would lead to not recognizing weird color codes and so on, but perhaps there could be a plugin system, where one could add a plugin that transforms color codes and such in the output into XML tree representation.

And then one could perhaps log the whole thing in various formats: Only visible text with colors, without colors, whole XML tree, or as JSON, or whatever other format it translates well to. Also could be extended via plugin.

But bare bones it merely treats everything as text.

Post reply on HN