76 comments

[ 4.9 ms ] story [ 78.0 ms ] thread
The thing with TUIs is that, using mobile native virtual keyboards, it's apparently quite impossible to make them behave in a sane way in browsers!

I think the only reasonable option seems to be reimplementing one yourself, which is massively stupid.

I use TUIs almost daily on my android phone, either some Linux application in Termux or a DOS application in DOSBox. Both have some extra on screen controls to add special keys, and DOSBox in particular allows adding widgets to control things (including invisible buttons, that are fun to add in some cases over parts of the screen in DOS to give an old game or application touch controls).
I also use Termux daily!

It's really a superb tool.

I only wish we could have that same experience without requiring a native app.

Charm looks good. What is the TUI library of choice for python these days?
Do we want tuis?

I can’t stand Gemmin-CLI. That tui gets in the way constantly

I’m mixed in jj’s tui. It’s better than no ui tho

Mostly tho I’m curious when I’d want a tui. Most of the time in a terminal I don’t want one

If it was so easy Anthropic wouldn't have messed up CC for so long. The author takes for granted the availability of good off-the-shelf TUI libraries for his chosen language.
I don't see any real advantage of TUIs over web forms or GUIs for the same thing.

I do like CLIs though, especially the ones that are properly capable of working in pipelines. Composing a pipeline of simple command-line utilities to achieve exactly what you want is very powerful.

- easy over ssh

- "within bounds" more; designed for actions with keyboard shortcuts and up/down/left/right

- less busy - devs are constrained or less tempted to add animations, css, and other distractions

I too enjoy the charm TUI libraries, and have been using them to build a settlers of Catan game[0]. And some features are really cool, like different colors depending on dark/light theme.

They have a bunch of functions that concatenate strings, which may not be very efficient compared to using string.builders, but I haven't yet had performance problems.

However I haven't had such a great experience with AI, IMO they're bad at ASCII art.

[0]: https://sr.ht/~vicho/el_poblador/

The problem with TUI's, that we have all Stockholm syndrom'd ourselves, is that I can't use the mouse cursor to click to the position on the screen and edit the command line.
Emacs vterm can do this. It's the only terminal emulator I'm aware of that can, because it seems nobody else cares. It can even backspace and delete all the text selected.
Dagger has a really nice TUI built on Charm. It reads OTEL to create an interactive tree for your builds and containers. If you have cloud setup, it will also push that all to a webapp interface where you can share and navigate in perpetuity. This works for both CI and local runs, super cool for sharing links to failed builds during dev, even while the dev's local build is still running

https://www.youtube.com/watch?v=EPEGTfaFnpA

I think mc (Midnight Commander) is still one of the best TUIs available - it's very close in capability to the GUI versions (like Double Commander) and it has the benefits of tuis - like that you can run it on a remote system. It looks outdated, but I'm actually now working on a new skin that will hopefully be included in the next release of mc.
I had bad feelings on MC, as it's flaky.

Far Manager or Dos Navigator are much better IMO.

As LLMs consume all our compute resources and drive up prices for the compute hardware on which we run applications, the silver lining is that LLMs are helpful in implementing tooling without a heavy stack so it will run quickly on a lower-spec computer.

I've achieved 3 and 4 orders of magnitude CPU performance boosts and 50% RAM reductions using C in places I wouldn't normally and by selecting/designing efficient data structures. TUIs are a good example of this trend. For internal engineering, to be able to present the information we need while bypassing the millions of SLoC in the webstack is more efficient in almost every regard.

Building an article is easy now.
(comment deleted)
Big reason why TUIs were popular in the first place is because they are so much simpler to build. Compare ncurses to GTK/Qt, they are completely different leagues. One of my pet ideas is to build a ncurses compatible/style library that skips terminal layer and instead renders directly to Wayland, kinda getting the simplicity of ncurses without dragging all the legacy junk with it.
> most importantly, they live inline to your code, preventing constant tab switching

No idea what this means.

I was working on a fairly niche thing, a library of crossplane compositions written in KCL and thought it would be nice to have a TUI so i could browse through them and see the rendered yaml as claude was working on it. I asked claude code to write it with python and textual and it one shotted it in about two minutes including a test suite.
Gemini built a nice TUI for me for a DHT scraper project I was coding:

https://imgur.com/a/u3KHbDT

It was like two-shot, cos the first version had some issues with CJK chars.

I was impressed as it would have taken me a bunch of screwing around on lining up all the data etc when I wanted to concentrate on the scraping algorithm, not the pretty bits.

I’d be interested to hear more about your project. I’ve heard about other DHT related things like search engines and such using it, but I haven’t explored the space much myself.
"DHT" as is "distributed hash table"?

(That is indeed a nice TUI.)

What libraries did it use?
I think TUIs-that-want-to-be-GUIs (as opposed to terminal commands just outputting plain text) are sad. Mainly because they’re largely inaccessible. They flatten the structure of a UI under a character stream. You’re forced to use it exactly the way it was designed and no different. Modern GUIs, even web pages too, expose enough structure to the OS to let you use it more freely. I get why people build TUIs, but it’s a sorry state of affairs.
They are GUIs --- just minecraft GUIs. One day, we will rediscover why GUI toolkits exist. The only real advantage TUIs have over GUIs is easy remoting, TBH. Maybe that's enough for people. Otherwise? They're just hair shirts.
> They flatten the structure of a UI under a character stream

Isn't this ... everything though? Even the browser which you mention as better in the next paragraph.

> You’re forced to use it exactly the way it was designed and no different

So ... Like all Apple products?

What is great about them is the constraints they impose on the UI designer. I spend so much time finding actions in apps like Zed, Obsidian or Slack because menus and rows of buttons are not cool anymore.

I'd really want explicit UIs from 2000, but in the mean time TUIs feel like an improvement.

I like that they are integrated into the terminal and stay in the terminal. For most things my terminal multiplexer is essentially my tiling window manager and everything that breaks out of that via its own window is very unergonomic and breaks the structured logic of my workflow. Technically just having a full GUI inside the boundaries of a terminal would be fine for a lot of things. But it's also one of these things where constraints make a lot of things better. Many GUIs are just really bloated and bad. TUIs just do not allow a lot of the sins of modern GUIs.

I agree that they can get very clunky for non text based tasks or anything where you actually need custom text formating.

I don't think most GUIs expose any more structure than TUIs.
"Creating garbage is easy now."

It runs poorly, loses keystrokes, and easily gets bogged down with too much terminal input.

I don't want candy coated monospace ASCII graphics. I want something fast and functional. The graphics are _entirely_ secondary. You've missed the point of what a TUI is.

Terminals still have poor keyboard support these days, starting with the Escape key (which should not be ASCII 27 IMO) and various ctrl/shift/alt... key combinations.
Alex,

It's somewhat ironic that a web page about performant terminal user interfaces uses gratuitously complex CSS mask compositing and cubic gradients which reduce smooth scrolling on my 1 year-old, high-end Dell XPS laptop (>$3k) to Commodore 64 level (on default 'Balanced' battery mode). While it's pretty, it's also just a very subtle, non-critical background animation effect. Not being a CSS guru myself, here's what Gemini says:

> "Specifically, this is a Scrim or Easing Gradient. Instead of a simple transition between two colors, it uses 16 color stops to mimic a "cubic-bezier" mathematical curve. This creates a smoother, more natural fade than a standard linear gradient, but it forces the browser to calculate high-precision color math across the entire surface during every scroll repaint."

My Firefox smooth scrolls like butter on thousands of pages, so you might want ask your web designer to test on non-Mac, iGPU laptops with hiDPI and consider the performance cost of web pages with always-running subtle background animations in a world of diverse hardware platforms. In case it helps, here's the animation with the gradient layers disabled so you can see all 6,400,000 pixels which are being recalculated every scroll line (https://i.imgur.com/He3RkEu.jpeg).

Notice how many times Claude Code was mentioned in this blog post nee advertisement?
FWIW, this page looks just fine in a text-only browser running in textmode, no X11, no Javascript, no CSS, on an old, underpowered computer
While I agree with your point, I don't understand why you added:

> here's what Gemini says

Surely, if people care to see LLM generated text, they can do it themselves.

imagine paying 3k$ for a laptop that can't even handle cubic gradients?
To read using Firefox, or any browser/HTML pager, without Javascript or CSS:

   (
   printf 'GET /blog/tuis-are-easy-now HTTP/1.0\r\n'
   printf 'Host: hatchet.run\r\n\r\n'
   )|busybox ssl_client hatchet.run \
   |(echo "<meta charset=utf-8>";grep -o "<p.*</p>") > 1.htm
   firefox ./1.htm
Don't blame my Commodore 64. Once a program is loaded it, runs with 50 or 60hz refresh rate, which is very smooth! Take that! :-)
TUIs are great fun and Claude can make beautiful ones with a little ratatui action super fast. However, the downside of these are that you can't use them with Claude Code so while I have a few I prefer to also have a prompt-response CLI function since that's better for lots of things.