All Projects → dankamongmen → Notcurses

dankamongmen / Notcurses

Licence: other
blingful character graphics/TUI library. definitely not curses.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Notcurses

AsciiTerminal
A Java ASCII terminal display usable with any Dwarf Fortress tileset
Stars: ✭ 22 (-95.94%)
Mutual labels:  terminal-emulators
Termox
C++17 Terminal User Interface(TUI) Library.
Stars: ✭ 306 (-43.54%)
Mutual labels:  ncurses
Terminology
The best terminal emulator based on the Enlightenment Foundation Libraries
Stars: ✭ 440 (-18.82%)
Mutual labels:  terminal-emulators
mushu
Mushu is a minimalist MPD client with a TUI and an incremental fuzzy finder for your music library
Stars: ✭ 30 (-94.46%)
Mutual labels:  ncurses
Chalk
🖍 Terminal string styling done right
Stars: ✭ 17,566 (+3140.96%)
Mutual labels:  terminal-emulators
Toaruos
A completely-from-scratch hobby operating system: bootloader, kernel, drivers, C library, and userspace including a composited graphical UI, dynamic linker, syntax-highlighting text editor, network stack, etc.
Stars: ✭ 4,687 (+764.76%)
Mutual labels:  terminal-emulators
nchat
Terminal-based Telegram client for Linux and macOS
Stars: ✭ 68 (-87.45%)
Mutual labels:  ncurses
Wavemon
wavemon is an ncurses-based monitoring application for wireless network devices on Linux.
Stars: ✭ 496 (-8.49%)
Mutual labels:  ncurses
Nvtop
NVIDIA GPUs htop like monitoring tool
Stars: ✭ 3,604 (+564.94%)
Mutual labels:  ncurses
Upterm
A terminal emulator for the 21st century.
Stars: ✭ 19,441 (+3486.9%)
Mutual labels:  terminal-emulators
Devour
X11 window swallower
Stars: ✭ 253 (-53.32%)
Mutual labels:  terminal-emulators
Vk
A console client for vk.com
Stars: ✭ 285 (-47.42%)
Mutual labels:  ncurses
Ttyd
Share your terminal over the web
Stars: ✭ 4,030 (+643.54%)
Mutual labels:  terminal-emulators
tic-tac-toe
Play tic-tac-toe in your Terminal
Stars: ✭ 42 (-92.25%)
Mutual labels:  ncurses
Neoterm
👍 A modern-designed Android terminal emulator for the 21st century.
Stars: ✭ 453 (-16.42%)
Mutual labels:  terminal-emulators
terminal-tetris
tetris written in C for linux terminal, featuring top notch ASCII graphics based on the original tetris game
Stars: ✭ 15 (-97.23%)
Mutual labels:  ncurses
Cfiles
A ncurses file manager written in C with vim like keybindings
Stars: ✭ 319 (-41.14%)
Mutual labels:  ncurses
Fabgl
Display Controller (VGA, SSD1306, ST7789, ILI9341), PS/2 Mouse and Keyboard Controller, Graphics Library, Sound Engine, Game Engine and ANSI/VT Terminal for the ESP32
Stars: ✭ 534 (-1.48%)
Mutual labels:  terminal-emulators
Tilix
A tiling terminal emulator for Linux using GTK+ 3
Stars: ✭ 4,670 (+761.62%)
Mutual labels:  terminal-emulators
Terminus
A terminal for a more modern age (formerly Terminus)
Stars: ✭ 24,959 (+4504.98%)
Mutual labels:  terminal-emulators

Notcurses: blingful TUIs and character graphics

  • What it is: a library facilitating complex TUIs on modern terminal emulators, supporting vivid colors, multimedia, threads, and Unicode to the maximum degree possible. Things can be done with Notcurses that simply can't be done with NCURSES. It is furthermore fast as shit.

  • What it is not: a source-compatible X/Open Curses implementation, nor a replacement for NCURSES on existing systems.

setting the standard (hype video)

birthed screaming into this world by [email protected]).

for more information, see dankwiki and the man pages. in addition, there is Doxygen output. there is a mailing list which can be reached via [email protected]. i wrote a coherent guidebook, which is available for free download (or paperback purchase).

i've not yet added many documented examples, but src/poc/ and src/pocpp/ contain many small C and C++ programs respectively. notcurses-demo covers most of the functionality of Notcurses.

If you're running Notcurses applications in a Docker, please consult "Environment notes" below. If you need Notcurses on Ubuntu Focal (20.04 LTS), you can run:

sudo add-apt-repository ppa:dankamongmen/notcurses
sudo apt-get update

Linux FreeBSD Build pypi_version crates.io Sponsor

Packaging status

Introduction

Notcurses abandons the X/Open Curses API bundled as part of the Single UNIX Specification. For some necessary background, consult Thomas E. Dickey's superb and authoritative NCURSES FAQ. As such, Notcurses is not a drop-in Curses replacement.

Wherever possible, Notcurses makes use of the Terminfo library shipped with NCURSES, benefiting greatly from its portability and thoroughness.

Notcurses opens up advanced functionality for the interactive user on workstations, phones, laptops, and tablets, possibly at the expense of e.g. some industrial and retail terminals. Fundamentally, Curses assumes the minimum and allows you (with effort) to step up, whereas Notcurses assumes the maximum and steps down (by itself) when necessary. The latter approach probably breaks on some older hardware, but the former approach results in new software looking like old hardware.

Why use this non-standard library?

  • Thread safety, and efficient use in parallel programs, has been a design consideration from the beginning.

  • A svelter design than that codified by X/Open: Exported identifiers are prefixed to avoid common namespace collisions. The library object exports a minimal set of symbols. Where reasonable, static inline header-only code is used. This facilitates compiler optimizations, and reduces loader time. Notcurses can be built without its multimedia functionality, requiring a significantly lesser set of dependencies.

  • All APIs natively support the Universal Character Set (Unicode). The cell API is based around Unicode's Extended Grapheme Cluster concept.

  • Visual features including images, fonts, video, high-contrast text, sprites, and transparent regions. All APIs natively support 24-bit color, quantized down as necessary for the terminal.

  • It's Apache2-licensed in its entirety, as opposed to the drama in several acts that is the NCURSES license (the latter is summarized as "a restatement of MIT-X11").

Much of the above can be had with NCURSES, but they're not what NCURSES was designed for. On the other hand, if you're targeting industrial or critical applications, or wish to benefit from its time-tested reliability and portability, you should by all means use that fine library.

Requirements

Minimum versions generally indicate the oldest version I've tested with; it may well be possible to use still older versions. Let me know of any successes!

  • (build) A C11 and a C++17 compiler
  • (build) CMake 3.14.0+
  • (build+runtime) From NCURSES: terminfo 6.1+
  • (build+runtime) GNU libunistring 0.9.10+
  • (build+runtime) GNU Readline 8.0+
  • (OPTIONAL) (build+runtime) From QR-Code-generator: libqrcodegen 1.5.0+
  • (OPTIONAL) (build+runtime) From FFmpeg: libswscale 5.0+, libavformat 57.0+, libavutil 56.0+
  • (OPTIONAL) (build+runtime) OpenImageIO 2.15.0+
  • (OPTIONAL) (testing) Doctest 2.3.5+
  • (OPTIONAL) (documentation) pandoc 1.19.2+
  • (OPTIONAL) (python bindings): Python 3.7+, CFFI 1.13.2+, pypandoc 1.5+
  • (OPTIONAL) (rust bindings): rust 1.47.0+, bindgen 0.55.1+, pkg-config 0.3.18+, cty 0.2.1+
  • (runtime) Linux 5.3+, FreeBSD 11+, or DragonFly BSD 5.9+

Here's more information on building and installation.

Included tools

Seven binaries are installed as part of Notcurses:

  • ncls: an ls that displays multimedia in the terminal
  • ncneofetch: a neofetch ripoff
  • ncplayer: renders visual media (images/videos)
  • nctetris: a tetris clone
  • notcurses-demo: some demonstration code
  • notcurses-input: decode and print keypresses
  • notcurses-tester: unit testing

To run notcurses-demo from a checkout, provide the data directory via the -p argument. Demos requiring data files will otherwise abort. The base delay used in notcurses-demo can be changed with -d, accepting a floating-point multiplier. Values less than 1 will speed up the demo, while values greater than 1 will slow it down.

notcurses-tester likewise requires that data, populated with the necessary data files, be specified with -p. It can be run by itself, or via make test.

Documentation

With -DUSE_PANDOC=on (the default), a full set of man pages and XHTML will be built from doc/man. The following Markdown documentation is included directly:

Environment notes

  • If your TERM variable is wrong, or that terminfo definition is out-of-date, you're going to have a very bad time. Use only TERM values appropriate for your terminal. If this variable is undefined, or Notcurses can't load the specified Terminfo entry, it will refuse to start, and you will not be going to space today.

  • Ensure your LANG environment variable is set to a UTF8-encoded locale, and that this locale has been generated. This usually means "[language]_[Countrycode].UTF-8", i.e. en_US.UTF-8. The first part (en_US) ought exist as a directory or symlink in /usr/share/locales. This usually requires editing /etc/locale.gen and running locale-gen. On Debian systems, this can be accomplished with dpkg-reconfigure locales, and enabling the desired locale. The default locale is stored somewhere like /etc/default/locale.

  • 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).

TrueColor detection

Notcurses primarily loads control sequences from terminfo(5), using the database entry specified by the TERM environment variable. 24-bit "TrueColor" color support (or at least the ability to specify 3 8-bit channels as arguments to setaf and setbf) is indicated by the rgb terminfo capability. Many terminals with RGB support do not advertise the rgb capability. If you believe your terminal to support 24-bit TrueColor, this can be indicated by exporting the COLORTERM environment variable as truecolor or 24bit. Note that some terminals accept a 24-bit specification, but map it down to fewer colors.

Fonts

Fonts end up being a whole thing, little of which is pleasant. I'll write this up someday FIXME.

It is worth knowing that several terminals draw the block characters directly, rather than loading them from a font.

FAQs

If things break or seem otherwise lackluster, please consult the Environment Notes section! You need to have a correct TERM and LANG definition, and probably want COLORTERM.

  • Q: The demo fails in the middle of intro. A: Check that your TERM value is correct for your terminal. intro does a palette fade, which is prone to breaking under incorrect TERM values. If you're not using xterm, your TERM should not be xterm!

  • Q: Can I have Notcurses without this huge multimedia stack? A: Yes! Build with -DUSE_MULTIMEDIA=none.

  • Q: In xterm, Alt doesn't work as expected. A: Check out the eightBitInput resource of xterm. Add XTerm*eightBitInput: false to your $HOME/.Xresources, and run e.g. xrdb -all -merge $HOME/.Xresources.

  • Q: Notcurses looks like absolute crap in screen. A: screen doesn't support RGB colors (at least as of 4.08.00); if you have COLORTERM defined, you'll have a bad time. If you have a screen that was compiled with --enable-colors256, try exporting TERM=screen-256color as opposed to TERM=screen.

  • Q: Notcurses looks like absolute crap in mosh. A: Yeah it sure does. I'm not yet sure what's up.

  • Q: Why didn't you just use Sixel? A: Many terminal emulators don't support Sixel. Sixel doesn't work well with mouse selection. With that said, I do intend to support Sixel soon, as a backend, when available, for certain types of drawing (see issue #200).

  • Q: I'm not seeing NCKEY_RESIZE until I press some other key. A: You've almost certainly failed to mask SIGWINCH in some thread, and that thread is receiving the signal instead of the thread which called notcurses_getc_blocking(). As a result, the poll() is not interrupted. Call pthread_sigmask() before spawning any threads.

  • Q: Using the C++ wrapper, how can I ensure that the NotCurses destructor is run when I return from main()? A: As noted in the C++ FAQ, wrap it in an artificial scope (this assumes your NotCurses is scoped to main()).

  • Q: How do I hide a plane I want to make visible later? A: In order of least to most performant: move it offscreen using ncplane_move_yx(), move it underneath an opaque plane with ncplane_move_below(), or move it off-pile with ncplane_reparent().

  • Q: Why isn't there an ncplane_box_yx()? Do you hate orthogonality, you dullard? A: ncplane_box() and friends already have far too many arguments, you monster.

  • Q: Why doesn't Notcurses support 10- or 16-bit color? A: Notcurses supports 24 bits of color, spread across three eight-bit channels. You presumably mean 10-bit-per-channel color. Notcurses will support it when a terminal supports it.

  • Q: The name is dumb. A: That's not a question?

  • Q: I'm not finding qrcodegen on BSD, despite having installed graphics/qr-code-generator. A: Try cmake -DCMAKE_REQUIRED_INCLUDES=/usr/local/include. This is passed by bsd.port.mk.

  • Q: Do you support musl? A: I try to! You'll need at least 1.20.

  • Q: I only seem to blit in ASCII, and/or can't emit Unicode beyond ASCII in general. A: Your LANG environment variable is underdefined or incorrectly defined, or the necessary locale is not present on your machine (it is also possible that you explicitly supplied NCOPTION_INHIBIT_SETLOCALE, but never called setlocale(3), in which case don't do that).

  • Q: I pretty much always need an ncplane when using a cell. Why doesn't the latter hold a pointer to the former? A: Besides the massive redundancy this would entail, cell needs to remain as small as possible, and you almost always have the ncplane handy if you've got a reference to a valid cell anyway.

  • Q: I ran notcurses-demo, but my table numbers don't match the Notcurses banner numbers, you charlatan. A: notcurses-demo renders several frames beyond the actual demos.

  • Q: When my program exits, I don't have a cursor, or text is invisible, or colors are weird, ad nauseam. A: Ensure you're calling notcurses_stop()/ncdirect_stop() on all exit paths, including fatal signals.

  • Q: How can I use Direct Mode in conjunction with libreadline? A: Pass NCDIRECT_OPTION_CBREAK to ncdirect_init(), and ensure you do not pass NCDIRECT_OPTION_NO_READLINE. If you'd like, set rl_readline_name and rl_attempted_completion_function prior to calling ncdirect_init(). With that said, consider using a Notcurses ncreader.

  • Q: Will there ever be Java wrappers? A: I should hope not. If you want a Java solution, try Autumn Lamonte's Jexer.

  • Q: Given that the glyph channel is initialized as transparent for a plane, shouldn't the foreground and background be initialized as transparent, also? A: Probably (they are instead initialized to default opaque). This would change some of the most longstanding behavior of Notcurses, though, so it isn't happening.

  • Q: Why does my right-to-left text appear left-to-right? A: Notcurses doesn't honor the BiDi state machine, and in fact forces left-to-right with BiDi codes. Likewise, ultra-wide glyphs will have interesting effects. ﷽!

  • Q: I get linker errors when statically linking. A: Are you linking all necessary libraries? Use pkg-config --static --libs notcurses to discover them.

  • Q: Can I avoid manually exporting COLORTERM=24bit everywhere? A: Sure. Add SendEnv COLORTERM to .ssh/config, and AcceptEnv COLORTERM to sshd_config on the remote server.

Useful links

Useful man pages

Grotesque vanity and meaningless metrics

stargazers over time

“Our fine arts were developed, their types and uses were established, in times very different from the present, by men whose power of action upon things was insignificant in comparison with ours. But the amazing growth of our techniques, the adaptability and precision they have attained, the ideas and habits they are creating, make it a certainty that profound changes are impending in the ancient craft of the Beautiful.” —Paul Valéry

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].