Bjorn Stahl edited this page May 8, 2018 · 2 revisions


TUI is a developer facing API built upon the SHMIF libraries in order to provide a stable interface (SHMIF itself isn't intended to be used directly outside the Arcan project) for creating text-oriented applications while taking advantage of most of the features exposed by SHMIF.

Its purpose is to provide a middle ground between the common high-level UI frameworks (HTML5, GTK, QT, ...) and glyph-based NCurses/Turbo-Vision like "character-stream" APIs.

The idea and status thus far is covered in two blog posts:

  1. Dreaming of a terminal-free CLI
  2. Dawn of a new Command Line Interface

The core argument is that the UI frameworks are much too complex, expensive and complicated to use, while the curses- like text user interfaces lack system integration for things like popups, window decorations, interactive IPC (clipboard, drag and drop, ...), error-prone and inefficient due to the weak separation of contents and metadata, legacy ridden due to the reliance on terminal protocols, with poor internationalisation.


One of the more difficult parts of maintaining a monospaced 'cell' view of textual user interfaces is modern text rendering in an international context. If it is not handled, a large part of the world is excluded and we all suffer for it. If it is handled, a very noticeable processing overhead is added.

The compromise that is used in TUI thus far is to default to a simple 'latin like script languages' where you have one character, a custom ID and a shaping break attribute per cell - along with per row reshaping hooks on rendering.


There is currently only a single implementation and renderer for the TUI api, and that is the one in shmif/arcan itself. There are bindings for the Lua language as part of the shmif/ sources in the main arcan repository - and a tool for testing them out in src/tools/ltui.


There are a few key applications that drive the development forward and to help finding rough edges in the API itself. The biggest, and most useful one, at the moment is the built-in terminal emulator (framserver/default/terminal).

Current ones in development are the "hidden" debughooks interface inside shmif, (non-public as of yet) a ltui- based UI driver for neovim, a lldb UI and a CLI shell ("LASH"). The translators in Senseye are also slowly being migrated to use it.

When those key projects are mature enough, the last two pieces - a packing format that is suitable for remote rendering (so that rendering can be pushed out of the client process and into the display server one) will be finalised, along with a standalone build of the Arcan terminal itself - to be used as a linux console replacement (think kmscon) or as a normal "terminal" inside Xorg/OSX/...

With documentation still pending, so far, please refer to shmif/arcan_tui.h for the C library header, src/tools/ltui for playing around with the Lua bindings (with documentation in doc/lua-tui-md), and tests/frameserver/tui_test for a C based skeleton for the API itself.