Live data from Hacker News

Writing Programs with Ncurses

invisible-island.net

31–40 of 93 posts

Re: Writing Programs with Ncurses

#31
post #28

Plain old HTML + forms can go a long way when accessed through the Lynx or w3 web browsers. I think the first time I encountered a system where this was the preferred path was in Kannel [0]. https://kannel.org/download/1.4.5/userguide-1.4.5/userguide....

I've never thought about this! I tried to write a simple TUI with ncurses, but it turned anything but simple real quick!

I don't think that this is inherent to ncurses but to any UI programming. Keeping state on the UI can be "simple" until is not.

Thanks for the idea, I'll give it a try!

Re: Writing Programs with Ncurses

#33
post #21

Any examples of modern apps with rich terminal GUI?

not sure how you define modern but things like neovim, neomutt and ranger come to mind.

I enjoy r/unixporn (it's actually sfw), they LOVE console apps there, everything from music to email to file manager to everything console!

There are also a few modern terminal emulators that are doing some pretty fun stuff with the terminal, some examples are alacritty, kitty and hyper

Re: Writing Programs with Ncurses

#38

I don't like text UIs. They try to emulate GUI but do it poorly. You should either make a classic console program, that can be scripted, piped, etc., or a real GUI.

Same here. Never liked using console text editors, in particular. When editing remote files, I always prefer using something like sshfs/WinSCP + Sublime Text.

Re: Writing Programs with Ncurses

#39
post #4

I love TUIs. They are clear, quick and easy to use. Probably because they require straightforward design. I just read the following links to build up foundation of knowledge first - low-level: http://%CA%9E.cc/irl/term.html https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode... https://en.wikipedia.org/wiki/ANSI_escape_code#Colors Other libraries: # C, C++, Python and Rust https://github.com/dankamongmen/not…

It feels like we live in a pretty good time for writing TUIs, CLIs and also small self-contained tools (thanks to languages like Go, which have a lot of libraries, are easy to use, but also compile to statically linked executables).

What stuck with me was using the Typer library for a Python tool that i wrote: https://typer.tiangolo.com/

It made regular shell scripts into a fully fledged CLI with nested commands thanks to just a few decorators that were sprinkled in the source files, as well as the occasional slight signature alteration.

Developing a GUI feels awfully complicated in comparison and i'm amazed that there don't seem to be all that many (if any) frameworks for creating GUIs in a similar way - by annotating method calls as actions that correspond to the actual GUI elements and letting some smart parsing logic handle the rest for you.

I feel like perhaps the world would be a slightly better place if desktop software could also be distributed as libraries of callable code, where you could automate button presses programmatically and there would be a 1:1 link between what you can do in code and manually.

Re: Writing Programs with Ncurses

#40
post #21

Any examples of modern apps with rich terminal GUI?

I don't know if it counts as rich, but I rolled my own terminal UI in my email client meli [0]. There's a web demo here: https://meli.delivery/wasm2.html that is the client compiled to webassembly and the ANSI escape codes translated to equivalent SVG drawing so that you can try it on your browser. [0] https://github.com/meli/meli/
Post reply on HN