Repository navigation
MacOS: GHOSTTY_QUICK_TERMINAL not inherited by split panes in Quick Terminal #12840
Unanswered
52dyd
asked this question in
Vouch Request
Replies: 2 comments 1 reply
|
This change affects macOS only. It does not affect any other platform. Reasons:
|
0 replies
|
@bo2themax @pluiedev @mitchellh Would appreciate your time reviewing this Vouch Request. You were the reviewers of the original PR #9673 that introduced the |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What do you want to change?
I want to fix a macOS-specific bug:
GHOSTTY_QUICK_TERMINAL=1is not present in split panes within a Quick Terminal window.Symptom: Opening a Quick Terminal and running
echo $GHOSTTY_QUICK_TERMINALoutputs1. But after splitting via Cmd+D in that same Quick Terminal, the same command in the new pane outputs nothing. Two community reports confirm this (#11637, #12652). Both reports are on macOS. There are no equivalent complaints on GTK. I verified that GTK behavior is indeed correct — making this a macOS-specific defect.Root cause: PR #9673 used different mechanisms on the two platforms. On GTK,
surface.zig'sdefaultTermioEnv()dynamically querieswindow.isQuickTerminal()every time it builds a subprocess environment — so every surface in a Quick Terminal window, including splits, naturally inherits the env var. On macOS,QuickTerminalController.animateIn()writes the env var into the first surface'sSurfaceConfiguration.environmentVariables— a one-shot, per-surface setting. When a split is created,ghostty_surface_inherited_config()is called, which does not propagateenv_vars. Fundamentally, a per-window property was misplaced at the per-surface level.Fix: Override
newSplit()inQuickTerminalControllerto injectGHOSTTY_QUICK_TERMINAL=1into the split surface's configuration before callingsuper.newSplit(). This matches the GTK semantics exactly: every surface created from a Quick Terminal controller carries the marker. Six lines of code, no public API changes.Location:
macos/Sources/Features/QuickTerminal/QuickTerminalController.swiftWhy do you want to make this change?
Quick Terminal detection serves real user needs. Users need to know whether their shell is running inside a Quick Terminal, for use cases including:
ignore_eof)I encountered the split issue in my own usage. After investigation, I found that the original implementation uses asymmetric mechanisms on macOS and GTK — GTK got it right as a per-window property, while macOS placed the same property at the wrong level (per-surface, one-shot configuration).
I manually verified seven scenarios, all passing:
The fix is on
52dyd/ghostty:fix/macos-quick-terminal-split-env.I acknowledge that:
All reactions