Live data from Hacker News

Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

nick-black.com

21–30 of 33 posts

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#22
post #18

Somewhat related ... Is there a proper name for a "top-like interface" ? I think that "TUI" refers very broadly to any terminal user interface and both 'vim' and 'alpine' and 'top' would fall under this broad category. But is there a specific name for a refresh-every-second, full page status output - like 'top' ? Is there a standard library for creating such an interface, or do people always use curses ? Presumably c…

TUI generally refers to a program that’s “full screen” with respect to the terminal it’s running in. Programs that don’t drive the whole terminal screen, instead generating output that may be mixed with other output in the same terminal, are often referred to as CLIs. curses dates back to around 1980: https://en.wikipedia.org/wiki/Ncurses#History

I guess but ... again, 'vim' or 'alpine' are very different than a constantly updating status like 'top'.

I guess I'll just keep calling it a "top-like interface".

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#23

Happy was the day I gave up on curses and just started splatting crap at the terminal with my own control codes. For too long did I think that curses was the one and only way to do anything with a terminal.

Care to elaborate on the control codes over curses? I’m curious :]

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#24

From page 8: "We don’t switch from blue to some other specified color, because we don’t know the background color of the terminal. Some people, possibly aliens, don’t favor a dark terminal background. If the terminal background were white, and we had just used e.g. ncdirect_fg(n, 0xffffff), text following “house” would be invisible. "One might observe that a user with a blue background will have invisible “house” tex…

[deleted]

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#25
post #21

The author of Notcurses released version 3.0.0 several days ago, a ton of work went into that! https://github.com/dankamongmen/notcurses/releases/tag/v3.0....

These release notes are such a joy to read.

thank you; i take pride in my documentation =]. and it's a lot of work; one ought have fun in the places you can.

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#26

From page 8: "We don’t switch from blue to some other specified color, because we don’t know the background color of the terminal. Some people, possibly aliens, don’t favor a dark terminal background. If the terminal background were white, and we had just used e.g. ncdirect_fg(n, 0xffffff), text following “house” would be invisible. "One might observe that a user with a blue background will have invisible “house” tex…

WITH THAT SAID, Notcurses can now acquire the default background from the terminal (this was not true when I wrote the book, sigh), and I fully support @akkartik's approach given this fact. Using NCALPHA_HIGHCONTRAST together with explicit reproduction of the user's chosen background is a complete and general solution to this problem, and I really ought update the book. Thanks, @akkartik!

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#27
post #7

Ok, if you're looking into notcurses, you may want to watch this: https://www.youtube.com/watch?v=dcjkezf1ARY (~ 6') the WTF effect that video had on me lasted quite a while. I still can't describe it.

that makes me so happy to hear. you have no idea how much of a pain in the ass that video was to make, lol--i'm really glad to hear it's been effective in carrying forth The Message.

i'm working on a new one now which is going to be some absolute Wizard of Oz shit; stay tuned. =] hack on!

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#28

Happy was the day I gave up on curses and just started splatting crap at the terminal with my own control codes. For too long did I think that curses was the one and only way to do anything with a terminal.

Care to elaborate on the control codes over curses? I’m curious :]

I 'maintain' a shell script/library that can do a lot of the basic things like color controls, control getch, move the screen cursor, etc. [0]

Taking a peek under covers to see how easy it is. A couple printfs from whatever language is way way less overhead than bundling in the whole of curses.

[0] https://git.sr.ht/~shakna/damned

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#29

Happy was the day I gave up on curses and just started splatting crap at the terminal with my own control codes. For too long did I think that curses was the one and only way to do anything with a terminal.

Care to elaborate on the control codes over curses? I’m curious :]

At its simplest, manage screen state yourself and redraw it by moving the cursor and colouring with ANSI codes:

https://gist.github.com/fnky/458719343aabd01cfb17a3a4f729679...

Turning the cursor on and off, 24 bit color, etc. A lot is possible though you potential sacrifice portability (which in 2021 translates to “don’t expect your stuff to render properly if your at the Linux console, and everywhere else it is fine.”)

Re: Hacking the planet with Notcurses: a guide to TUIs (2020) [pdf]

#30

From page 8: "We don’t switch from blue to some other specified color, because we don’t know the background color of the terminal. Some people, possibly aliens, don’t favor a dark terminal background. If the terminal background were white, and we had just used e.g. ncdirect_fg(n, 0xffffff), text following “house” would be invisible. "One might observe that a user with a blue background will have invisible “house” tex…

WITH THAT SAID, Notcurses can now acquire the default background from the terminal (this was not true when I wrote the book, sigh), and I fully support @akkartik's approach given this fact. Using NCALPHA_HIGHCONTRAST together with explicit reproduction of the user's chosen background is a complete and general solution to this problem, and I really ought update the book. Thanks, @akkartik!

<3 TUI FTW
Post reply on HN