A4 is a dynamic terminal window manager. One of eight tiling layouts is dynamically applied to all visible terminals. The terminal windows are grouped by tags making it easy to visually switch between contexts of work. Color schemes are dynamically applied to each terminal window, based on the text in its titlebar, helping the user to visually identify terminals based on attributes such as hostname, userid, and any other text programmed to display in the titlebar.
Four of the eight layouts divide the screen into two areas, one for a zoomed window and the other for a stack of the remaining windows. These four layouts can be adjusted during use to expand or shrink the number of windows in the zoom area and the overall size of the zoom area. They are named for the location of the zoom area: zoom_left, zoom_right, zoom_top, and zoom_bottom. The other four layouts are fullscreen, grid, rows, and columns.
Each terminal window can be tagged with one or more tags. The user then selects which tag or tags to view, and all windows with those tags are arranged in the dynamic layout. The list of all tags is displayed on the left of the status bar. Tag names are user defined with the default being the numerals 1 through 9.
Terminal windows can be minimized to a bar at the bottom of the screen. A minimized terminal keeps its tags but stays out of the user's way until it is unminimized again. Terminal windows can be set to read-only status in order to prevent accidental typing or closing. Terminal windows can be added to a focus group in order to type the same input into all simultaneously. Minimized and read-only terminal windows are never typed into, even if they are included in the focus group.
Terminal color schemes are dynamically applied by comparing the text of the terminal's title with an ordered set of user-defined color rules.
A4 supports 24-bit truecolor and is configurable by editing an a4.ini file. It is a partial rewrite of dvtm, which in turn is a text-based implementation of dwm.
Parts of the screen
tag layout key names symbol combo status text ╱ ╱ ╱ ╱ status bar ┌─┬─┬─┬─┬───────────────────────────────────┐╱ │1│2│3│4│ ├─ ^Gv YYYY-MM-DD | a4│ ├─┴─┴─┴─┴─────────────┬─────────────────────┤ ├─────────────────────┼─────────────────────┤╲ │ │ │ title bars │ │ terminal │ │ │ window │ │ terminal │ │ │ window ├─────────────────────┤ │ ├─────────────────────┤╲ │ │ │ title bar │ ╱│ terminal │ │ frame line │ window │ │ │ │ ├──────────────┬──────┴──────┬──────────────┤ └──────────────┴─────────────┴──────────────┘╲title bars of minimized windows
Layouts
zoom_left zoom_right zoom_top zoom_bottom ┌───────┬───────┐ ┌───────┬───────┐ ┌───────────────┐ ┌────┬────┬─────┐ │ a4 │ │ │ │ a4 │ │ a4 │ │ │ │ │ │ ├───────┤ ├───────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ ├────┬────┬─────┤ ├────┴────┴─────┤ │ ├───────┤ ├───────┤ │ │ │ │ │ │ a4 │ │ │ │ │ │ │ │ │ │ │ │ │ └───────┴───────┘ └───────┴───────┘ └────┴────┴─────┘ └───────────────┘ ┌───────────────┐ ┌───────┬───────┐ ┌───────────────┐ ┌────┬────┬─────┐ │ a4 │ │ a4 │ │ │ a4 │ │ a4 │ │ │ │ │ │ │ │ ├───────────────┤ │ │ │ │ │ │ ├───────┼───────┤ │ │ │ │ │ │ │ │ │ │ │ ├───────────────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └───────────────┘ └───────┴───────┘ └───────────────┘ └────┴────┴─────┘ fullscreen grid rows columns
┌─────────┬─────┐ │ a4 │ │ │ ├─────┤ zoom_left layout ├─────────┤ │ zoomnum = 2 │ ├─────┤ zoomsize = 60% │ │ │ └─────────┴─────┘
Some Technical Details
While a4 is similar to dvtm, it has some important differences. One of the notable differences is that a4 has a configuration text file that may be edited to your liking, so you don't need to recompile the software to customize the settings. This is implemented using the inih package.
Another notable difference is providing support for 24-bit
truecolor. Depending on the underlying terminal emulator that you're
running a4 on, you may need to set the environment variable
COLORTERM
. Setting it to either truecolor
or
24bit
will force a4 to enable this support. A4 replaced the
ncurses
back end with
libtickit
for text drawing and keyboard and mouse input processing. In addition,
terminal processing is performed using the
libvterm
library.
A4 is written in C and is currently about 3000 lines of code.
To do
- Fix line buffering so that extreme resizing doesn't truncate.
- copy/paste
Resources
- libtickit - Terminal Interface Construction Kit
- libvterm - An abstract library implementation of a VT220/xterm/ECMA-48 terminal emulator
- inih - a simple .INI file parser written in C
- ANSI escape code from Wikipedia
- XTerm Control Sequences, by Edward Moy, revised by Stephen Gildea, Thomas Dickey
- everything you ever wanted to know about terminals (but were afraid to ask), by Lexi Summer Hale
- Gogh - Color schemes for your terminal
- a4 color name table
Related Projects
- dvtm - dynamic virtual terminal manager
- dwm - dynamic window manager
- abduco - a tool for session {at,de}tach support
- dislocate - a simple Expect script to disconnect and reconnect processes (my personal first experience with disconnecting)
- GNU Screen - a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells
- tmux - a terminal multiplexer
- ncurses - a library of functions that manage an application's display on character-cell terminals (e.g., VT100)
- ISO 216 - an international standard for paper sizes, including A4, the most commonly available paper size worldwide