Skip to content

Add Ghostty.app support#87

Open
weijing24 wants to merge 1 commit into
mklement0:masterfrom
weijing24:add-ghostty-support
Open

Add Ghostty.app support#87
weijing24 wants to merge 1 commit into
mklement0:masterfrom
weijing24:add-ghostty-support

Conversation

@weijing24
Copy link
Copy Markdown

@weijing24 weijing24 commented Mar 19, 2026

Summary

  • Add Ghostty as a supported terminal on macOS, alongside Terminal.app and iTerm2.app
  • Ghostty is automated via its native AppleScript API (introduced in v1.3.0), using surface configuration objects for working directory and initial input
  • Supports new windows, new tabs, horizontal/vertical splits (-h/-v), tab titles (-t), background mode (-g/-G), and auto-detection via $TERM_PROGRAM
  • Named profiles (-s) are not supported in Ghostty; a warning is emitted if specified

Implementation details

  • Detection: $TERM_PROGRAM == 'ghostty', explicit via -a Ghostty, or fallback via mdfind with bundle ID com.mitchellh.ghostty
  • Tab/window creation: new tab in front window / new window with surface configuration
  • Splits: split right (vertical) / split down (horizontal) on the focused terminal
  • Working directory: Set via initial working directory on the surface configuration (no cd prepend needed)
  • Commands: Sent via initial input on the surface configuration with & return
  • Tab titles: set name of selected tab of front window
  • Background (-G): Save/restore via select tab and AXRaise GUI scripting

Test plan

  • ttab — open new tab (inherits working directory)
  • ttab -w — open new window
  • ttab -v / ttab -h — vertical/horizontal splits
  • ttab -G <cmd> — background tab with command
  • ttab -t "title" — custom tab title
  • ttab -d /path — explicit working directory
  • ttab -s profile — warns that profiles are unsupported
  • --dry-run output verified for all combinations

Add Ghostty (ghostty.org) as a supported terminal on macOS, alongside
Terminal.app and iTerm2.app. Ghostty is automated via its native
AppleScript API (introduced in v1.3.0), using surface configurations
for working directory and initial input, and supports new windows,
new tabs, and horizontal/vertical splits (-h/-v).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mklement0
Copy link
Copy Markdown
Owner

@weijing24, I appreciate your contribution, but there are a number of problems:

  • Some of the commands don't work:

    • ttab -h / ttab -v yields: Ghostty got an error: Can’t make down into type specifier. (-1700)

    • ttab -t foo yields: 322:371: execution error: Ghostty got an error: Can’t set name of tab to "foo". (-10006)

  • The -c and -l options should result in a fatal error (dieSyntax) when targeting Ghostty, due to non-support; an attempt to use the unsupported -s option - which in your code currently yields a warning - should also yield a fatal error, for consistency with how existing non-supported options are treated.

    • The source-code comments in your code suggest that -c is supported, but it currently yields 321:334: syntax error: Expected “timeout” or “transaction” but found identifier. (-2741) - if there is a way to make -c work, that's preferable.
  • Re --help text:

    • It doesn't note that -g and -G are also supported in Ghostty.
  • Re --man text:

    • It hasn't been updated to reflect Ghostty support, notably with respect to it not being covered by automated tests.
    • The 2 trailing spaces that some lines end in must be retained, as they signal an intentional line break to Markdown rendering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants