npx skills add ...
npx skills add reason-machines/trending-skills --skill ghostling-libghostty-terminal
Build minimal terminal emulators using the libghostty-vt C API with Raylib for windowing and rendering
npx skills add reason-machines/trending-skills --skill ghostling-libghostty-terminal
Skill by ara.so — Daily 2026 Skills collection.
Ghostling is a minimal viable terminal emulator built on libghostty-vt, the embeddable C library extracted from Ghostty. 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.
libghostty-vt does NOT provide: windowing, rendering, PTY management, tabs, splits, or configuration.
| Tool | Version |
|---|---|
| CMake | 3.19+ |
| Ninja | any |
| C compiler | clang/gcc |
| Zig | 0.15.x (on PATH) |
| macOS | Xcode CLT or Xcode |
After first configure, only the build step is needed:
Warning: Debug builds are very slow due to Ghostty's safety/correctness assertions. Always benchmark with Release builds.
All implementation lives in main.c. Below are the key patterns extracted from it.
The render state API tells you exactly which cells changed and how to draw them — no need to redraw everything every frame.
libghostty-vt has no PTY management — you own this:
The project fetches libghostty-vt automatically via CMake FetchContent:
| Problem | Fix |
|---|---|
Build fails: zig not found | Install Zig 0.15.x and ensure it's on $PATH |
| Debug build extremely slow | Use Release: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| Terminal renders garbage | Verify you're calling ghostty_render_state_begin before iterating cells and ghostty_render_state_end after |
| Child process not getting resize | Call ioctl(pty_fd, TIOCSWINSZ, &ws) AND kill(child_pid, SIGWINCH) after ghostty_terminal_resize |
| Kitty keyboard protocol broken | Known upstream Raylib/GLFW limitation — libghostty-vt supports it correctly but needs richer input events |
| Colors look wrong | Check cell.fg/cell.bg — libghostty-vt resolves palette to RGB, use those values directly |
ghostty_terminal_write crashes | Ensure buffer passed is valid and len > 0; never pass NULL |
You must implement these yourself:
Full libghostty-vt C API docs: https://libghostty.tip.ghostty.org/group__render.html__