Hacker News new | ask | show | jobs
by pmarreck 506 days ago
I don't know why (other than being a Gen X nerd) but I have a bizarre affinity for nicely-written TUI apps of late! Things like btop++ that respond to mouse clicks and smoothly reflow when the terminal window is resized etc...

Shout-out to Charmbracelet's stuff such as Glow (https://github.com/charmbracelet/glow) and Gum (https://github.com/charmbracelet/gum) for rendering markdown nicely in the terminal and for using TUI in your shell scripts

6 comments

Huge fan of wrapping simple PowerShell tools with Gum for making things a bit nicer for colleagues to use, Charm’s entire catalogue is art
I love Charm so much.
This TUI is really beautiful. Looking at those rounded corners I am wondering if it is using some specific font created just for TUI.
They're in the Unicode box drawing block. https://en.wikipedia.org/wiki/Box-drawing_character
I am aware of those, I have used them, but this font has rounded corners on boxes, that's why I believe it is a custom font.
The code references FiraCode:

https://github.com/EnhancedJax/Bagels/blob/7b4bfd051f6beff8f...

But the actual character is: ╯

256F ╯ Box Drawings Light Arc Up And Left

https://www.unicode.org/charts/nameslist/n_2500.html

Baked into the Textual framework!
Textual automatically has a rounded border style for containers!
Good TUI apps are written for efficiency. With a few keystroke you can navigate around and take actions that can be slower and tax more using GUIs and even more using modern GUIs. It appears to me that TUIs are seeing a rise in interest and that is probably not just fad driven, they're a lot more efficient for some tasks. Of course TUIs aren't for everyone and the learning curve could be steeper (not necessarily so though).
I too am obsessed with beautiful TUI apps. I would love to see them inside a browser to lower the barrier to entry for the majority of folks. Almost like an emulated terminal inside the browser that’s simply accessed by url.

Are there any frameworks or examples of this being done?

Not sure but https://angband.live/ lets you play Angband (a purely terminal game) in the browser, or watch other people play it live, which is kind of neat
ssh in the browser + self-hosting is usually all you need.
browser terminal + ssh + self hosting!

I’ve not looked into this is years but I once had this idea that in browser terminal and I remember discovering there exists javascript xterm implementation.

For me though I was thinking the setup needs custom MFA security since public browsers or devices can be compromised. Haven’t researched yet how to somehow add that to the access.

If it worked how I’d imagine you can just walk up to any computer with a modern browser, go to your self-hosted IP, it sends you access code to phone, or uses authenticator or rsa token, something, and you get your terminal access.

I currently host an ssh-only game that logs you in based on your github user. Ie: ssh withinboredom@my-game and it looks your keys up at github.com/withinboredom.keys ... then uses that as the authorized keys (this is all built-in to ssh btw).

It wouldn't be too difficult to extend this to support webauthn/passkeys via a little bit of magic.

Actually... that sounds like a pretty interesting project.

I was thinking more completely self contained. Did some research and seems it might be possible with xterm + webcontainer.
TUI is the superior ui. Works locally and via ssh.
But not on mobile, which is a big draw back especially for something you might want to do on the go (Op said that’s not the goal, but for me it would be)
Textual can run the tui apps as web apps.

https://github.com/Textualize/textual-web

On Android you can install a Linux app and run it there. UX may be lacking. But add a BT keyboard and mouse and it ain't bad.
That’s really not what people understand as a “mobile” experience.
In that case best option is if this writes to files use Dropbox and another app that understands the format.
iOS has terminals too now, but of course sandboxed. You could install this in there, though, and no linux needed.
k9s is also nice
lazydocker as well. Also a big fan of bottom (https://github.com/ClementTsang/bottom) , which surprisignly enough even though it has charts and everything, it consumes way fewer resources on my system compared to htop.