Skip to content
Bjorn Stahl edited this page Apr 7, 2019 · 7 revisions

TUI

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, ...), and are error-prone and inefficient due to the weak separation of contents and metadata. The terminal legacy blocks them from having an input model which match the rest of the system, colors lacks semantics and certain keypresses are nothing more than clever guesswork. Race conditions glitches are everywhere, blocking latency improvements, and attaching other media providers to the cell layout, are, at best, unscalable hacks.

Use

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.

Widgets

Basic widgets have started to appear; currently a generic text/hex viewer and a list-like component. These can be found in src/shmif/arcan_tui_listwnd.h and arcan_tui_bufferwnd.h respectively.

Development

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. See the source-code in:

src/frameservers/terminal/default/arcterm.c

While not a particularly complex application, it shows how to get the basic loop and event handlers going.

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

When all components have matured sufficiently, TUI and the related projects will move out of the main Arcan source repository into one of its own.

Big items currently missing are:

  1. Handover / embed launch for invoking afsrv_decode
  2. "readline" like widget missing
  3. Lua bindings incomplete still
  4. Renderer backend refactor to allow server-side text rendering
  5. Helper- code for localisation