gassyterm

Terminal emulator written on C++.

Build from source

Requires CMake ≥ 3.16, a C++17 compiler, and the X11, Xft and fontconfig packages

cmake -S . -B build
cmake --build build -j"$(nproc)"

The binary lands at build/gassyterm.

Run

./build/gassyterm

It always starts the system's default shell for your user, i.e. the login shell from the passwd database (falling back to $SHELL, then /bin/sh). Close the window or leave the shell (exit, ^D) to quit. The window resizes in whole character cells and tells the shell about it via SIGWINCH.

Configuration

Settings are read once at startup from $XDG_CONFIG_HOME/gassyterm/config, or ~/.config/gassyterm/config when XDG_CONFIG_HOME is unset. The file is created with the defaults on first run, and changes apply the next time you open the window (no rebuild needed).

# ~/.config/gassyterm/config
font = monospace:size=11
foreground = #cccccc
background = #0b0b0b
cursor = #cccccc
columns = 80
rows = 24
color4 = #2472c8        # optional: override any of color0..color15
  • font is a fontconfig pattern, so size, family and style go in one string ("Iosevka:size=13:weight=medium"). If it cannot be matched, a generic monospace font is used instead.
  • Colours are #rrggbb. cursor falls back to foreground.
  • columns and rows set the initial window size in cells.
  • Unknown keys and malformed values are reported on stderr and ignored, so a typo never stops the terminal from starting.

How it works

  • src/pty.cpp opens a pty pair (posix_openpt), forks, attaches the slave as the child's controlling terminal and execs the shell; also handles TIOCSWINSZ.
  • src/ansi.cpp is a byte-level escape sequence state machine (ground, escape, CSI, OSC, DCS). It turns pty output into print/execute/CSI/ESC events without touching the screen.
  • src/terminal.cpp consumes those events: cursor movement, erasing, inserting and deleting characters and lines, scrolling, SGR attributes, saved/restored cursor, and UTF-8 decoding into cells.
  • src/screen.h is the cell grid; each cell keeps up to four bytes of UTF-8, foreground/background palette indices and attribute bits.
  • src/config.cpp reads the startup settings from the XDG config directory and creates a commented default file when there is none.
  • src/x11.cpp is the window: display and window setup, fontconfig/Xft font loading, the 256-colour palette, key mapping (modelled on st), and cell-by-cell rendering into a pixmap that is blitted on expose.
  • src/main.cpp runs a select loop over the X connection and the pty, feeds pty output to the terminal and repaints when the screen is dirty.

Keys

Return, Backspace (^H and ^?), Tab, Shift+Tab, Escape, arrows, Home, End, Insert, Delete, Page Up/Down and F1–F12 send the usual xterm sequences. Ctrl+letter sends the matching control code; Alt+key prefixes ESC.

Supported

  • Cursor movement (A B C D E F G H f d), insert/delete (@ P L M X), erase (J K), scroll (S T)
  • SGR attributes (0 1 2 3 4 7 22 23 24 27) and 16/256 colour (30-37 40-47 90-97 100-107 38;5 48;5 38;2 48;2)
  • ESC 7/ESC 8 and CSI s/CSI u cursor save/restore, ESC M reverse index
  • CSI ? 25 h/l cursor visibility, UTF-8 output, tab, bell

Not supported

Scroll regions (CSI r), alternate screen buffers, scrollback, mouse reporting, text selection/clipboard, and OSC title or clipboard sequences. Unrecognised sequences are parsed and ignored rather than printed literally.

S
Description
Gassiest terminal emulator.
Readme
73 KiB
Languages
C++ 96.7%
Shell 2.4%
CMake 0.9%