Projects /Â rt
git clone https://molodetz.nl/retoor/rt.git
RT Terminal
RT (Rapid Terminal) is a terminal emulator implemented in C11 using GTK4 and VTE. The application provides hardware-accelerated rendering, complete ANSI escape sequence processing, and POSIX-compliant pseudoterminal management.
Technical Specifications
| Component | Implementation | |-----------|----------------| | Language | C11 (ISO/IEC 9899:2011) | | UI Toolkit | GTK4 (4.10+) | | Terminal Backend | VTE 2.91-gtk4 (0.76+) | | Font Rendering | FreeType2 with Pango/Cairo | | PTY Interface | UNIX 98 pseudoterminals | | Build System | Meson + Ninja | | Binary Size | ~115KB (stripped) |
Architecture
rt/
├── src/
│ ├── main.c # Entry point, environment setup
│ ├── rt-application.c/h # GtkApplication lifecycle
│ ├── rt-window.c/h # Window management, actions
│ ├── rt-terminal.c/h # VTE wrapper, shell spawning
│ ├── rt-tabs.c/h # Tab container management
│ ├── rt-config.c/h # INI configuration parser
│ ├── rt-theme.c/h # Color palette management
│ ├── rt-font.c/h # Font description, DPI scaling
│ ├── rt-pty.c/h # PTY allocation (unused, VTE handles)
│ ├── rt-ansi.c/h # ANSI sequence validator
│ ├── rt-clipboard.c/h # Clipboard, OSC 52 handler
│ ├── rt-shortcuts.c/h # Keyboard accelerators
│ └── rt-utils.c/h # Path resolution, color parsing
├── data/
│ ├── rt.desktop # XDG desktop entry
│ └── rt.svg # Application icon
└── config/
└── rt.conf.example # Configuration template
Rendering Pipeline
RT configures FreeType2 interpreter version 40 for improved glyph rendering:
FREETYPE_PROPERTIES=truetype:interpreter-version=40
Font rendering parameters:
- Antialiasing: Subpixel (CAIRO_ANTIALIAS_SUBPIXEL)
- Hint Style: Full (CAIRO_HINT_STYLE_FULL)
- Hint Metrics: Enabled (CAIRO_HINT_METRICS_ON)
- Subpixel Order: RGB (CAIRO_SUBPIXEL_ORDER_RGB)
These settings are applied per-widget via
pango_cairo_context_set_font_options()
.
Differentiation from GNOME Terminal
| Aspect | RT | GNOME Terminal | |--------|----|----| | Toolkit | GTK4 native | GTK4 (migrated) | | Configuration | INI file | dconf/GSettings | | Theme System | Built-in palettes | Profile-based | | Font Config | Direct FreeType control | System defaults | | Startup | Single GObject chain | Full GNOME integration | | Dependencies | Minimal (5 libraries) | GNOME platform |
Color Support
ANSI 16-Color Palette
Standard SGR codes 30-37 (foreground) and 40-47 (background) with bright variants 90-97/100-107.
256-Color Mode
Extended palette via
ESC[38;5;{n}m
and
ESC[48;5;{n}m
:
- 0-15: Standard ANSI colors
- 16-231: 6x6x6 color cube (r * 36 + g * 6 + b + 16)
- 232-255: Grayscale ramp (24 shades)
24-bit Truecolor
Direct RGB specification via
ESC[38;2;{r};{g};{b}m
and
ESC[48;2;{r};{g};{b}m
.
Environment variables set by RT:
TERM=xterm-256color
COLORTERM=truecolor
Built-in Themes
| Theme | Background | Foreground | |-------|------------|------------| | Dracula | #282a36 | #f8f8f2 | | Nord | #2e3440 | #d8dee9 | | Solarized Dark | #002b36 | #839496 | | Solarized Light | #fdf6e3 | #657b83 | | Gruvbox | #282828 | #ebdbb2 |
All themes implement the full 16-color ANSI palette with theme-appropriate mappings.
Dependencies
Runtime Libraries
| Library | Minimum Version | Purpose | |---------|-----------------|---------| | GTK4 | 4.10 | UI toolkit | | VTE | 0.76 | Terminal widget | | FreeType2 | 2.10 | Font rasterization | | Pango | 1.50 | Text layout | | Cairo | 1.16 | 2D rendering | | GLib | 2.74 | Core utilities |
Build Dependencies
| Tool | Purpose | |------|---------| | GCC/Clang | C11 compiler | | Meson | Build configuration | | Ninja | Build execution | | pkg-config | Dependency resolution |
Installation Commands
Debian/Ubuntu:
apt install build-essential meson ninja-build pkg-config \
libgtk-4-dev libvte-2.91-gtk4-dev libfreetype-dev \
libpango1.0-dev libcairo2-dev
Fedora:
dnf install gcc meson ninja-build pkg-config \
gtk4-devel vte291-gtk4-devel freetype-devel \
pango-devel cairo-devel
Arch Linux:
pacman -S base-devel meson ninja gtk4 vte4 freetype2 pango cairo
Build Instructions
Release build:
meson setup build --buildtype=release --prefix=/usr
meson compile -C build
Debug build:
meson setup build --buildtype=debug -Denable_debug_logging=true
meson compile -C build
Using Make wrapper:
make release # Optimized build
make debug # Debug symbols
make install # Install to PREFIX
make run # Build and execute
Installation
System-wide:
meson install -C build
Or via Make:
make PREFIX=/usr install
Configuration
Location:
~/.config/rt/rt.conf
[font]
family=JetBrains Mono
size=11
antialiasing=true
hinting=true
subpixel=true
[theme]
name=Dracula
[terminal]
scrollback_lines=10000
scroll_on_output=false
scroll_on_keystroke=true
bold_is_bright=true
cursor_blink=true
cursor_shape=block
[bell]
audible=false
visual=true
[shell]
command=/bin/bash
Cursor Shapes
-
block- Filled rectangle -
ibeam- Vertical line -
underline- Horizontal line
Keyboard Shortcuts
| Action | Accelerator |
|--------|-------------|
| Copy |
<Ctrl><Shift>c
|
| Paste |
<Ctrl><Shift>v
|
| New Tab |
<Ctrl><Shift>t
|
| Close Tab |
<Ctrl><Shift>w
|
| Next Tab |
<Ctrl>Page_Down
|
| Previous Tab |
<Ctrl>Page_Up
|
| New Window |
<Ctrl><Shift>n
|
| Zoom In |
<Ctrl>plus
|
| Zoom Out |
<Ctrl>minus
|
| Zoom Reset |
<Ctrl>0
|
| Fullscreen |
F11
|
| Quit |
<Ctrl>q
|
Shortcuts are configurable via the
[shortcuts]
section in
rt.conf
.
Clipboard Integration
Standard Clipboard
GTK4 clipboard API with support for:
- Primary selection (middle-click paste)
- Clipboard selection (Ctrl+Shift+C/V)
OSC 52
Remote clipboard access via escape sequence:
ESC ] 52 ; c ; <base64-data> BEL
Selection targets:
-
c- Clipboard -
p- Primary -
s- Secondary
Signal Handling
The terminal forwards signals to child processes:
-
SIGWINCH- Window resize notification -
SIGHUP- Hangup on terminal close -
SIGTERM- Graceful termination request
Environment
Variables set for child processes:
TERM=xterm-256color
COLORTERM=truecolor
SHELL=<user shell>
File Locations
| Path | Purpose |
|------|---------|
|
~/.config/rt/rt.conf
| User configuration |
|
/usr/share/rt/rt.conf
| Default configuration |
|
/usr/share/applications/rt.desktop
| Desktop entry |
|
/usr/share/icons/hicolor/scalable/apps/rt.svg
| Application icon |
Exit Codes
| Code | Meaning | |------|---------| | 0 | Normal termination | | 1 | GTK initialization failure | | 127 | Shell execution failure |
License
MIT License. See LICENSE file.
Source
13 component modules, approximately 3,500 lines of C code.