Skip to content

macOS GhosttyKit: expose child PID / TTY on ghostty_surface_t #12065

@mitchellh

Description

@mitchellh

Discussed in #12063

Originally posted by SyedSibtainRazvi April 2, 2026
Hey, I'm relatively new to terminal internals and embedding. I'm building a macOS terminal that embeds libghostty via the C API. It has a learning panel that detects when Claude Code is running in a terminal tab and generates quiz questions from the session context.

Currently I'm detecting Claude by scanning viewport text for markers (prompt symbol), which works but is fragile. With multiple tabs open, I need to reliably map a process to a specific surface.

Exposing the child PID or TTY on ghostty_surface_t would solve this: Something like

pid_t ghostty_surface_child_pid(ghostty_surface_t);
  
const char* ghostty_surface_tty(ghostty_surface_t);

Related to #10756 and #11592 which request the same data for AppleScript and App Intents. This would be the C API equivalent for embedders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions