Architecture

Architecture Overview

How Kytos layers libghostty, KelyphosKit, and Swift
Properties3
Is BaseNo
Iconi-lucide-layers
Order10

Kytos is layered across three components:

LayerComponentResponsibility
Terminal enginelibghosttyEmulation, Metal rendering, PTY, splits
Shell chromeKelyphosKitNavigator, inspector, utility, NSToolbar
ApplicationKytos Swift sourcesBridge, session model, persistence, widget

Key Types

TypeRole
KytosGhosttyApp@Observable @MainActor singleton wrapping ghostty_app_t
KytosGhosttyViewNSView wrapping ghostty_surface_t — Metal layer, keyboard/mouse, IME
KytosTerminalRepresentableNSViewRepresentable bridging KytosGhosttyView into SwiftUI
KytosWorkspace@Observable split tree model for one window/tab
KytosAppModelWindow-to-workspace mapping, persistence, widget snapshots

Process Model

Kytos runs as a single process. libghostty is linked as a static library (GhosttyKit.xcframework). All terminal rendering happens on the Metal layer managed by KytosGhosttyView. The Swift UI layer runs on the main actor.

Data Flow

Ghostty C callbacks → KytosGhosttyApp → KytosWorkspace → SwiftUI
OSC escape sequences → KytosGhosttyView → toolbar title/subtitle
shell integration scripts → PTY → KytosGhosttyView → navigator labels
widget snapshot → KytosAppModel → JSON file → KytosWidget