Notcurses

From LinuxReviews
Jump to navigationJump to search
Notcurses
nctetris running in the KDE Konsole.
nctetris running in the KDE Konsole.
Original author(s)Nick Black
Initial releaseNovember 30, 2019; 2 years ago (2019-11-30)
Repositorygithub.com/dankamongmen/notcurses
Written inC (C++/Rust/Python wrappers are available)
TypeTextual widget toolkit
LicenseApache 2.0
Konsole.svg

notcurses, as in not ncurses, is a thread-safe library for building complex user interfaces for modern terminal emulators. It is written in C with C++ safe headers. It can be used to create games, image viewers and a lot more. The library comes bundled with a tetris game, a image viewer and a "demo" application that shows of its capabilities.

notcurses can be used to make C++, Rust and Python applications thanks to notcurses wrappers for those programming languages.

Features[edit]

  • notcurses supports 24-bit 8bpc RGB color. Colors are quantize down for indexed palette terminals.
  • notcurses supports transparency and semi-transparency (a terminal with support is obviously required)
  • notcurses has full Unicode support, including bidirectional text and glyphs
  • it supports images using OpenImageIO and, in theory, video via ffmpeg
  • it support fade/in and fade/out of text-blocks / sub-regions
  • it supports blitters, rotation and scaling

Bundled Software[edit]

Notcurses-demo.jpg
The bundled notcurses-demo application.

The notcurses library comes bundled with several programs. Some distributions opt to ship them in a separate package called notcurses-utils though they aren't really utilities. The included programs are, as of version 2.5.0:

ncls A ls that shows image previews in terminals
ncneofetch A neofetch/UwUfetch like program that shows information about your distribution, kernel, terminal and a few other things
ncplayer A simple multimedia player that lets you view images, and supposedly videos, in terminals. The video output would be similar to mpv's caca output driver (mpv -vo caca) if it actually worked. Viewing images is the only thing this "player" is capable of, it doesn't actually play video files.
nctetris A tetris clone. You can move left and right with h and l or the and arrow keys, rotate the pieces with z and x and move pieces down with with j or the down arrow key.
notcurses-demo A demo-program that shows of the various capabilities the notcures library has to offer
Notcurses-demo-map.jpg
notcurses-input Tool for decoding and printing keystrokes
notcurses-tester Unit testing

Documentation[edit]

The primary developer has written a 153 pages long book about notcurses titled "Hacking the Planet (with Notcurses) - A Guide to TUIs and Character Graphics". The e-book edition is available for free at https://nick-black.com/htp-notcurses.pdf.

Video Presentation[edit]

Notcurses developer Nick Black gave a 15 minute talk titled Notcurses: Making terminals do things that were never intended at LibrePlanet 2021.

There is a pretty complete API reference guide available.

Availability And Support[edit]

Most GNU/Linux distributions have a version of notcurses in their repositories. It is safe to assume that distributions will be able to include your program if you write one with a interface using the notcurses library.

notcurses applications run fine in most modern terminal emulators including konsole, xfce4-terminal and even xterm. It doesn't work very well with screen multiplexers like tmux and screen.

Links[edit]


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.