Ghostty terminals

Ghostex embeds Ghostty natively for agent CLI sessions. Terminals are first-class AppKit surfaces with shared Ghostty configuration, reliable copy/paste, and the same pane layout model as browsers and T3 Code.

GhosttyNative terminalszmx

What it is

Ghostex uses embedded Ghostty (terminalEngine: ghostty-native) instead of xterm.js or a web-based terminal. Each agent or shell session renders in a native Ghostty SurfaceView inside the macOS workspace.

Ghostty ships with bundled themes, terminfo, and runtime resources in the app bundle. Ghostex strips inherited color-disabling environment keys at the native boundary so agent CLIs keep ANSI color output.

How it works

Terminal lifecycle in Ghostex:

  • New sessions receive a Ghostex environment overlay (agent metadata, prompt editor, persistence provider) before Ghostty attaches.
  • zmx-backed sessions ask gxserver for render metadata before Swift creates the Ghostty surface.
  • Pane layout sizes step to whole Ghostty character cells, including configured terminal padding.
  • Sleep keeps the renderer as a view owner; wake recreates or reattaches the surface and may replay resume commands.
  • Remote session clicks can open a local Ghostty terminal that SSH-attaches with the stable ghostex attach contract.

Terminal settings in Ghostex write documented Ghostty config keys to the shared Ghostty config file. External Ghostty windows read the same file; embedded terminals reload about three seconds after you stop changing controls.

Default terminal profile

New Ghostex installs seed this baseline (overridable in Settings):

OptionWhat it does
ThemeGitHub Dark
FontJetBrains Mono 13pt, font-variation wght=300
CursorBar cursor with blink enabled
Line height1.2 (20% cell height expansion in Ghostty config)
Scrollback15 MB per surface
Copy on selectOff
Mouse scrollPrecision 1, discrete 1
ScrollbarSystem
Paste previewable imagesOn (app-owned, not a Ghostty key)

Settings sections

Settings → Terminal (typography & theme):

OptionWhat it does
ghosttySettingsActionsApply recommended settings, open config file, open Ghostty docs, reset defaults.
terminalGhosttyThemeBundled theme or Use existing Ghostty config.
terminalFontFamilyGhostty font-family string; blank preserves existing config.
terminalFontSize8–32 pt (0.5 step).
terminalFontWeight100–900 (maps to font-variation wght=…).
terminalLineHeight0.8–2.0 row height multiplier.
terminalLetterSpacingGlyph spacing via adjust-cell-width.
terminalCursorStyleLine (bar), Block, or Underline.
terminalCursorStyleBlinkBlink the terminal cursor.
sessionPersistenceProviderOff or zmx (recommended) for new terminal/agent sessions.
showSessionIdInTerminalPanesShow provider session id in the top-right of terminal panes when persistence is enabled.
promptEditorBackendCtrl+G prompt editor backend (see Rich prompt editor docs).

Settings → Terminal Behavior:

OptionWhat it does
terminalScrollbackLimitMb1–200 MB scrollback memory per surface.
terminalCopyOnSelectOff, Selection clipboard, or System and selection clipboard.
terminalConfirmCloseSurfaceSmart confirmation, Always confirm, or Do not confirm.
terminalClipboardTrimTrailingSpacesTrim trailing whitespace on copy (default on).
terminalClipboardPasteProtectionAsk before pasting text Ghostty considers unsafe (default on).
terminalPastePreviewableImagesPaste images as previewable Markdown links (default on).
terminalMouseHideWhileTypingHide pointer while typing.
terminalScrollbarSystem or Never.

Settings → Terminal Scrolling:

OptionWhat it does
terminalMouseScrollMultiplierPrecisionTrackpads / hi-res wheels (Ghostty default 1).
terminalMouseScrollMultiplierDiscreteNotched wheels (Ghostty default 3; Ghostex default 1).
terminalScrollToBottomWhenTypingKeep prompt visible while typing (default on).

Shared Ghostty config

Ghostex-managed keys include theme, fonts, cursor, scrollback, clipboard behavior, mouse-scroll multipliers, and split opacity. The recommended config also sets macos-option-as-alt = true and shell-integration features for SSH.

  • Apply recommended settings from Settings → Terminal for the Ghostex baseline palette.
  • Open config file jumps to your Ghostty config on disk.
  • External Ghostty windows may need Cmd+Shift+, to reload after changes.
  • Ghostty docs link opens https://ghostty.org/docs/config/reference.

Warning shown in Settings:

Whatever you set here also applies to your external Ghostty terminal
because this Ghostty terminal uses the same settings file.

Copy, paste, and images

OptionWhat it does
Cmd+CUses Ghostty's copy action when text is selected so clipboard matches the terminal selection.
Middle clickDisabled for paste in embedded Ghostty terminals.
Paste protectionGhostty prompts before pasting potentially unsafe text when enabled.
Cmd+V / Ctrl+V imagesWhen Paste previewable images is on, bitmap clipboard paste stores durable file references instead of dumping base64 into the shell.
Ctrl+VPasses through to terminal programs unless the clipboard currently contains an image (then Ghostex intercepts for image paste).

Keyboard shortcuts

Ghostex app shortcuts for terminal workflows (defaults, rebindable in Settings → Hotkeys):

OptionWhat it does
Cmd+TCreate Session — new terminal tab after the focused tab.
Cmd+DSplit focused pane horizontally.
Cmd+Shift+DSplit focused pane vertically.
Cmd+RRename active session.
Ctrl+Shift+RReload focused session.
Ctrl+Shift+LRotate panes clockwise.
F12Open Commands panel.
Cmd+BCollapse/expand sidebar.

Ghostty-native shortcuts while terminal focus is inside the embed:

  • Cmd+Shift+, — reload Ghostty config in external Ghostty windows.
  • Option acts as Alt for terminal keybindings when macos-option-as-alt is enabled.
  • Visible native scrollbars with square scroll-to-top/bottom overlay buttons.

Sleep and persistence

Terminal sessions interact with Ghostex sleep and persistence policies:

  • Session Persistence provider zmx (recommended) keeps new terminal/agent sessions restorable across restarts and remote attach.
  • Turning persistence Off shows a warning that Android/iOS attach can have issues.
  • Click to wake sleeping panes (Settings → Workspace): selecting a sleeping tab shows a black placeholder until you click the pane body.
  • Agent Auto Sleep never sleeps the focused agent session; terminal candidates come from gxserver presentation when active.
  • Delayed Send timers block auto-sleep for affected terminal sessions.

CLI commands

OptionWhat it does
ghostex create-sessionCreate a shell terminal session.
ghostex create-agent <id>Launch a configured agent in a new terminal.
ghostex send-text / send-enter / send-keyInject input into the selected Ghostty surface.
ghostex read-textRead terminal screen buffer or visible viewport.
ghostex sleep-session / reload-sessionSleep or reload a terminal session.
ghostex attachAttach to a remote or persisted session (stable --session-id / --project-id contract).
gx create-agent codex
gx send-text codex "summarize the last error"
gx read-text --index 0 --visible
gx sleep-session g-0614-120000 true

Tips

  • Use zmx persistence when you want SSH or mobile attach to resume the same named sessions Ghostex created.
  • Enable show session id in terminal panes while debugging zmx attach from another machine.
  • If scroll feels too fast or slow, tune precision and discrete multipliers separately — Ghostty treats them as different device classes.
  • Apply recommended Ghostty settings after major upgrades to pick up the GitHub Dark + JetBrains Mono baseline.
  • Enable Debugging Mode temporarily when diagnosing focus steals — native activation and pane-tab geometry logs help trace terminal focus issues.

Related docs