February 16, 2019

Discovering ncurses, the GUI for the Linux Console - page 2

ncurses, a GUI for the Linux Console

  • January 25, 2010
  • By Juliet Kemp

It's entirely possible to run an ncurses-based program within a terminal running in an X environment. The main thing to bear in mind when doing this is that the ncurses mouse-handling overrides the X mouse-handling while the mouse pointer is within the window that the ncurses application is running in. So you can use the mouse to click on menus and links, but you can't (unless the program implements this itself) copy-and-paste using the normal X methods.

In terms of a straight comparison between ncurses and X as ways of providing a graphical interface, X certainly provides much more scope for things like moving between terminals, and cutting-and-pasting between terminals. Fundamentally, X provides a way of managing multiple windows within a desktop environment, and ncurses doesn't. screen, which uses part of the ncurses code, does provide multiple terminals within one session, which you can paste between, but you can't natively cut-and-paste between two separate instances of screen, or even use X to do this between ncurses programs in separate terminals.

ncurses applications are also less aesthetically pleasing, by and large, than X applications, due to the limitations imposed by operating within a terminal; they tend to look quite blocky and very text-based. The extent to which ncurses applications are GUI-like is more about their logic and internal navigation than it is about their aesthetics. However, this 'graphical logic' can be incredibly useful. Being able to use the mouse for browsing within w3m is useful; and being able to use a menu-driven system for configuring a new Linux kernel (with make menuconfig) is incredibly useful and makes the task significantly easier. (There is also an X kernel configuration tool available, but you don't always have X running when you're rebuilding a kernel!).

Even in a modern system, it's not necessarily the case that a full-on GUI will actually give you significant improvements. Depending on what you're doing, the graphical login of ncurses may be enough of an improvement over a text-only CLI; and ncurses applications are way more lightweight than X applications. Most importantly, they don't require you to be running an X server, which isn't always either desirable or practical.

If your focus is on aesthetic beauty, or you need a desktop-style environment, then by all means stick with X and regular GUIs. If you want ease-of-use and low overheads, and you're either not bothered about graphical bells and whistles, or running in a terminal or console environment, ncurses-based programs can make that terminal environment far more usable, fast, and productive.

Most Popular LinuxPlanet Stories