
Ghostling Libghostty Terminal
Embed a minimal VT terminal in a C app by wiring libghostty-vt parsing and render state to Raylib (or another renderer).
Overview
ghostling-libghostty-terminal is an agent skill for the Build phase that shows how to embed libghostty-vt terminal emulation with Raylib for windowing and rendering.
Install
npx skills add https://github.com/aradotso/trending-skills --skill ghostling-libghostty-terminalWhat is this skill?
- Single-file Ghostling reference on libghostty-vt + Raylib
- Documents VT parsing, terminal state, scrollback, and render-state delta API
- Lists explicit boundaries: libghostty provides no windowing, PTY, tabs, or config UI
- Kitty keyboard protocol, mouse tracking, focus reporting, and grapheme handling noted
- Build toolchain: CMake 3.19+, Ninja, clang/gcc; zero-dep VT core (WASM-compatible)
- Single C file reference implementation
- CMake 3.19+ and Ninja listed as build requirements
Adoption & trust: 1k installs on skills.sh; 31 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want terminal emulation inside your own app but full terminals like Ghostty are too heavy and the libghostty-vt API boundaries are unclear.
Who is it for?
C/C++ builders embedding a VT in Raylib or another 2D/GPU renderer who accept owning PTY and window management.
Skip if: Teams wanting a no-code terminal or a batteries-included tabbed emulator without writing C integration glue.
When should I use this skill?
Building a terminal with libghostty, using libghostty-vt C API, embedding terminal emulation, or working with libghostty render state API.
What do I get? / Deliverables
You understand how to connect VT input, terminal state, and render-state updates to your renderer and which platform pieces you must implement yourself.
- Integration plan for VT parse loop and render-state diff drawing
- Build layout matching Ghostling-style libghostty + windowing split
- Checklist of features you must implement (PTY, config, tabs) outside libghostty-vt
Recommended Skills
Journey fit
Build is correct because the skill is implementation-focused: CMake, bindings, PTY wiring, and rendering—not distribution or ops runbooks. Integrations reflects embedding a terminal engine into your own windowing stack rather than shipping a standalone CLI tool only.
How it compares
Integration skill for libghostty-vt embedding—not a Rust/Tauri app scaffold or a web-only xterm.js wrapper guide.
Common Questions / FAQ
Who is ghostling-libghostty-terminal for?
Indie tool makers and systems-minded solo devs building CLIs, dev environments, or custom apps that need real terminal emulation via the Ghostty VT library.
When should I use ghostling-libghostty-terminal?
Use it in Build when integrating libghostty-vt, embedding a minimal emulator, or mapping render-state APIs—only during implementation, not for growth or launch tasks.
Is ghostling-libghostty-terminal safe to install?
The skill describes native C builds and PTY integration; review the Security Audits panel on this page and audit any cloned Ghostling or Ghostty sources before compiling.
SKILL.md
READMESKILL.md - Ghostling Libghostty Terminal
# Ghostling — libghostty Terminal Emulator > Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection. Ghostling is a minimal viable terminal emulator built on **libghostty-vt**, the embeddable C library extracted from [Ghostty](https://ghostty.org). It uses Raylib for windowing/rendering and lives in a single C file. The project demonstrates how to wire libghostty-vt's VT parsing, terminal state, and render-state API to any 2D or GPU renderer. ## What libghostty-vt Provides - VT sequence parsing (SIMD-optimized) - Terminal state: cursor, styles, text reflow, scrollback - Render state management (what cells changed and how to draw them) - Unicode / multi-codepoint grapheme handling - Kitty keyboard protocol, mouse tracking, focus reporting - Zero dependencies (not even libc) — WASM-compatible **libghostty-vt does NOT provide:** windowing, rendering, PTY management, tabs, splits, or configuration. ## Requirements | Tool | Version | |------|---------| | CMake | 3.19+ | | Ninja | any | | C compiler | clang/gcc | | Zig | 0.15.x (on PATH) | | macOS | Xcode CLT or Xcode | ## Build & Run ```sh # Clone git clone https://github.com/ghostty-org/ghostling.git cd ghostling # Debug build (slow — safety checks enabled) cmake -B build -G Ninja cmake --build build ./build/ghostling # Release build (optimized) cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release cmake --build build ./build/ghostling ``` After first configure, only the build step is needed: ```sh cmake --build build ``` > **Warning:** Debug builds are very slow due to Ghostty's safety/correctness assertions. Always benchmark with Release builds. ## Project Structure ``` ghostling/ ├── main.c # Entire terminal implementation (single file) ├── CMakeLists.txt # Build config; fetches libghostty-vt + Raylib └── demo.gif ``` ## Core libghostty-vt API Patterns All implementation lives in `main.c`. Below are the key patterns extracted from it. ### 1. Initialize the Terminal ```c #include "ghostty.h" // provided by libghostty-vt via CMake // Create terminal with cols x rows cells ghostty_terminal_t *terminal = ghostty_terminal_new( &(ghostty_terminal_config_t){ .cols = cols, .rows = rows, } ); if (!terminal) { /* handle error */ } ``` ### 2. Write Data from PTY into the Terminal ```c // Read from PTY fd, feed raw bytes to libghostty-vt ssize_t n = read(pty_fd, buf, sizeof(buf)); if (n > 0) { ghostty_terminal_write(terminal, buf, (size_t)n); } ``` ### 3. Send Keyboard Input ```c // libghostty-vt encodes the correct escape sequences ghostty_key_event_t ev = { .key = GHOSTTY_KEY_A, // key enum .mods = GHOSTTY_MODS_CTRL, // modifier flags .action = GHOSTTY_ACTION_PRESS, .composing = false, }; uint8_t out[64]; size_t out_len = 0; ghostty_terminal_key(terminal, &ev, out, sizeof(out), &out_len); // Write encoded bytes to PTY if (out_len > 0) write(pty_fd, out, out_len); ``` ### 4. Send Mouse Events ```c ghostty_mouse_event_t mev = { .x = cell_col, // cell column .y = cell_row, // cell row .button = GHOSTTY_MOUSE_LEFT, .action = GHOSTTY_MOUSE_PRESS, .mods = GHOSTTY_MODS_NONE, }; uint8_t out[64]; size_t out_len = 0; ghostty_terminal_mouse(terminal, &mev, out, sizeof(out), &out_len); if (out_len > 0) write(pty_fd, out, out_len); ``` ### 5. Resize the Terminal ```c ghostty_terminal_resize(terminal, new_cols, new_rows); // libghostty-vt handles text reflow automatically // Send SIGWINCH to the c