Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Notcurses: Blingful character graphics/TUI library (github.com/dankamongmen)
162 points by tosh on Feb 2, 2024 | hide | past | favorite | 45 comments


The FAQ has some interesting entries:

Can I use Notcurses in my closed-source program?

Notcurses is licensed under Apache2, a demonstration that I have transcended your petty world of material goods, fiat currencies, and closed sources. Implement Microsoft Bob in it. Charge rubes for it. Put it in your ballistic missiles so that you have a nice LED display of said missile's speed and projected yield; right before impact, scroll "FUCK YOU" in all the world's languages, and close it out with a smart palette fade. Carve the compiled objects onto bricks and mail them to Richard Stallman, taunting him through a bullhorn as you do so.


Someone clearly understands what open source is about. It's a pet peeve of mine when devs pick permissive licenses and then act all appalled when it's inevitably not taken as do-no-evil copyleft.

If you have expectations, spell them out! We are not mind readers, different people and projects happen in very different contexts and backgrounds. Assuming or even worse, asserting, that there are some common principles or standards beyond whats written down is just narrowminded and maybe even hypocritical.


Well, to be fair the brick could be wrapped in a copy of the gpl and stallman would be fine. Presumably the requested source code could also be delivered by a second brick.


I'm reminded of a similar 'dark' quote from Theo de Raadt in 2001:

"...But software which OpenBSD uses and redistributes must be free to all (be they people or companies), for any purpose they wish to use it, including modification, use, peeing on, or even integration into baby mulching machines or atomic bombs to be dropped on Australia..."[0]

[0] https://marc.info/?l=openbsd-cvs&m=99118909527873&w=2


Chaotic neutral


I went to grad school with that guy. He’s a riot.


No, no, this is lawful neutral.


Edginess rarely ages well.


The same primary author just recently published a novel as well. If you enjoy the writing style of the readme/faq you may enjoy it too. Feels like it might be a good vacation read.

midnight's simulacra https://a.co/d/8tcx82V


Posting an affiliate link is frowned upon, btw.


No affiliate link there (at least not intentionally) that’s the link that Amazon app brings up with share/copy link functionality. Mods feel free to alter/delete as needed.


Yeah bro you affiliate linked it.


That’s my bad! Will expand those out and remove going forward. I shouldn’t be surprised that Amazon app does by default now.


Link without affiliate tracking: https://www.amazon.com/dp/B0CRP2MM28


Bought his book just to support his efforts, yes I'm the one guy. He's got the type of chaotic energy real hackers generate. Love everything he's put on youtube.


The name is a bit close to “ncurses”. Also a screenshot early on would be helpful to illustrate what it can be used for.


There’s also a yt video showing a demo that can be run after installing notcurses: https://www.youtube.com/watch?v=dcjkezf1ARY

Pretty hefty.


Is it able to show actual videos or is that just to make the demo more interesting and inserted externally?

I would like to combine something like this with https://github.com/runvnc/tersenet or some of those ideas.


It can show actual videos using the Sixel protocol. You already have terminals that support it too. Just run `xterm -ti 340`. In that terminal, run an application such as Gnuplot:

    gnuplot -e "set terminal sixelgd;set hidden3d;set view 62, 30, 1.1, 1.2;set samples 50, 50;set isosamples 51;set contour base;set cntrparam order 8;set cntrparam bspline;splot [-12:12.01] [-12:12.01] 2*sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)+x/53+y/37"



Yes, but that’s both fairly far down the page and not really a good example of what an actually application might look like



The api is lower–level than that. It is very similar to ncurses which just gives you a primitive window; a rectangular subsection of the screen that can be scrolled independently of the rest. It doesn’t give you a bunch of UI widgets like buttons and checkboxes that can be conveniently shown off in screenshots. You can build a whole TUI without ever even using those windows, because in a lot of UIs the content of the windows don’t need to scroll.

(And of course there’s all that stuff about colors, and notcurses adds functions for rendering bitmaps and videos into windows that ncurses doesn’t have.)


Are those dots just like a density map/gradient? Or are they real symbols / characters?


Unicode braille symbols


Are there devices that can render those as something that blind people can feel?


Sure, braille terminals exist. See https://en.wikipedia.org/wiki/Refreshable_braille_display for some examples.


The link at the starting of the second sentence "Things can be done with Notcurses that simply can't be done with NCURSES." does more justice for what it can do than any screenshots would.


"ncurses" is pretty close to the original "curses" https://en.wikipedia.org/wiki/Curses_(programming_library)


Watched a bit of the demo video. Maybe I'm not the target audience but is this kind of an emacs approach to the terminal, in the sense of trying to put every possible graphical function into a TUI? For me at least the charm of TUIs is their graphical and functional simplicity, and if I wanted complex animations and layering and whatever all else that is I would look elsewhere... still cool though


Demos might seem superficial, but very often in CLI applications, there's this one little thing that if only could be done via bitmap would improve usability by a lot. And it's possible.


> If your terminal has an option about default interpretation of "ambiguous-width characters" (this is actually a technical term from Unicode), ensure it is set to Wide, not narrow (if that doesn't work, ensure it is set to Narrow, heh)

lovely!


For the handful slightly fancy TUI applications I wrote, I had some fun in just using raw escape sequences.

I really like the buildkit output style, I couldn't figure out how to do something like this – multiline output without a full-term application – with curses, so I did it myself.


Yeah, I built a TUI framework for fun. I was playing with making a TUI browser where everything is rendered server side like html and streamed over grpc.

http://uggly.bytester.net


I suppose you don't worry about the termcap madness and just rely on terminals being compatible enough?


Absolutely, yes, should've mentioned that. Most of these tools are for internal use at my company and I know what terminals they run in – even better: I can just test it.

But honestly, some of these run in tmux on my machine and in the Windows Terminal in production and both do the same thing. I guess if you assume modern, emulated terminals and don't do exotic stuff (I mostly move the cursor and clear lines), you can go some way without termcap. It's a tool from a time when terminals where physical machines.


I remember when I decided I wanted to create a TUI for ROS2, I went through tens of libraries trying to figure out which would be best suited for what I wanted. I remember stumbling upon Nick's book "Hacking the planet with Notcurses". I Loved his attitude and passion, and felt it was fitting for what I was working on.

I was always impressed by how clean and consistent Notcurses was, I never found myself wanting for functionality or power. It was always performant and stayed out of my way when I was doing the un-orthodox. I consider it a shining example of the kind of culture that got me into this sort of thing. I look forward to working with it again when I find the excuse!


this guy is clearly some sort of genius. i love this so much. incredible.


His Bio on Amazon:

Computer scientist, nuclear engineer, clandestine chemist, novelist. nick black holds numerous degrees from Georgia Tech, and has worked at Nvidia, Google, and Intel, in addition to founding several companies. He's currently a principal engineer on Microsoft's Orbital space team.

https://www.amazon.com/stores/author/B086T64DLG/about


Are there escape codes for some of these things? Or most of them? I know you can draw a sixel image but can you shrink it etc. with some escapes read over ssh?


No, there is no escape code to shrink a sixel image. You have to do it the hard way: erase it, shrink the bitmap, and then redraw it.


I dont know, but the vid says terminal support is detected at runtime, and ssh support is mentioned around 1:29 in the video. So eh maybe?


Nick presents the following nightmarish dystopia: what if the demoscene were created by americans?

What a bad vibe. Get away from me, please


I disagree but this is an extremely funny insult


Goddamnit, Nick.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: