Repository navigation
macos: fix GHOSTTY_QUICK_TERMINAL not set for quick terminal splits - #12896
Conversation
Scope and Known LimitationsTwo pre-existing bugs are related to this scenario but are outside the scope of this PR.
The typical Quick Terminal usage pattern is: Instant pop-up → Adaptive prefill → Swift execution → Multi-pane splits → Dismiss on done. The vast majority of use cases involve neither dragging panes out of the Quick Terminal nor relying on state restoration after a restart. This fix is therefore pragmatic and focused — it addresses the missing The fundamental root cause is a design trade-off in original PR #9673: a per-window property was placed at the per-surface configuration layer. Fully addressing the remaining edge cases would require deeper changes (with proportionally greater risk), which is beyond the scope of this contribution. A complete resolution is open to further discussion by community contributors. |
This violates our AI policy, but the two points are valid, please read them before doing your next contribution or comments. If you can't write English directly, you can use AI to translate instead just letting it to generate them for you. |
Thank you for your patience. I'll follow the community policy next time. |
Fixes #12895
Problem
On macOS, split panes created via Cmd+D in the Quick Terminal do not inherit
GHOSTTY_QUICK_TERMINAL=1. The initial surface correctly receives the variable, but new split panes do not. Community disscussions report #11637 and #12652 confirm this is macOS-specific.Root Cause
OriginalPR #9673 used different mechanisms on each platform:
defaultTermioEnv()dynamically querieswindow.isQuickTerminal()for every surface, a per-window property.animateIn()writes the env var into the first surface'sSurfaceConfiguration.environmentVariables, a per-surface, one-shot configuration.When a split is created,
ghostty_surface_inherited_config()does not propagateenv_vars, so the new pane never receives the variable.Fix
Override
newSplit()inQuickTerminalControllerto injectGHOSTTY_QUICK_TERMINAL=1before callingsuper.newSplit(). This matches the GTK semantics: all surfaces created from a Quick Terminal Controller carry the marker.The change is 6 lines, in a single file:
macos/Sources/Features/QuickTerminal/QuickTerminalController.swift. No public API changes, no cross-platform impact.Verification
I manually verified the following scenarios.
zig build): no errorsecho $GHOSTTY_QUICK_TERMINAL→111AI Assistance Disclosure
Claude Code Opus 4.7 was used to analyze the original implementation logic and verify the change's impact scope. All code was reviewed and edited by myself before submission. AI also helped with the English translation work.