Skip to content

macos: fix GHOSTTY_QUICK_TERMINAL not set for quick terminal splits - #12896

Merged
bo2themax merged 1 commit into
ghostty-org:mainfrom
52dyd:fix/macos-quick-terminal-split-env
Jun 3, 2026
Merged

bo2themax merged 1 commit into
ghostty-org:mainfrom
52dyd:fix/macos-quick-terminal-split-env

Conversation

@52dyd

@52dyd 52dyd commented Jun 2, 2026

Copy link
Copy Markdown

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:

  • GTK: defaultTermioEnv() dynamically queries window.isQuickTerminal() for every surface, a per-window property.
  • macOS: animateIn() writes the env var into the first surface's SurfaceConfiguration.environmentVariables, a per-surface, one-shot configuration.

When a split is created, ghostty_surface_inherited_config() does not propagate env_vars, so the new pane never receives the variable.

Fix

Override newSplit() in QuickTerminalController to inject GHOSTTY_QUICK_TERMINAL=1 before calling super.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.

  • Full build (zig build): no errors
  • Quick Terminal initial surface: echo $GHOSTTY_QUICK_TERMINAL → 1
  • Cmd+D split (right/down/left/up): new pane → 1
  • Multiple nested splits: all panes → 1
  • Normal (non-Quick-Terminal) window: → (empty)
  • Normal window Cmd+D split: → (empty)

AI 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.

@52dyd
52dyd requested a review from a team as a code owner June 2, 2026 10:59
@ghostty-bot ghostty-bot Bot added the os/macos label Jun 2, 2026
@52dyd

52dyd commented Jun 2, 2026

Copy link
Copy Markdown
Author

Scope and Known Limitations

Two pre-existing bugs are related to this scenario but are outside the scope of this PR.

  1. Panes dragged out of the Quick Terminal retain GHOSTTY_QUICK_TERMINAL (the env var is written at surface creation time and follows the surface).
  2. After quitting and relaunching the app, GHOSTTY_QUICK_TERMINAL is not restored with the panes in the Quick Terminal.

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 GHOSTTY_QUICK_TERMINAL in the split pane scenario (#12895) and delivers a meaningful improvement to the macOS user experience.

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.

@bo2themax

Copy link
Copy Markdown
Member

Scope and Known Limitations

Two pre-existing bugs are related to this scenario but are outside the scope of this PR.

  1. Panes dragged out of the Quick Terminal retain GHOSTTY_QUICK_TERMINAL (the env var is written at surface creation time and follows the surface).
  2. After quitting and relaunching the app, GHOSTTY_QUICK_TERMINAL is not restored with the panes in the Quick Terminal.

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 GHOSTTY_QUICK_TERMINAL in the split pane scenario (#12895) and delivers a meaningful improvement to the macOS user experience.

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.

@52dyd

52dyd commented Jun 2, 2026

Copy link
Copy Markdown
Author

Scope and Known Limitations

Two pre-existing bugs are related to this scenario but are outside the scope of this PR.

  1. Panes dragged out of the Quick Terminal retain GHOSTTY_QUICK_TERMINAL (the env var is written at surface creation time and follows the surface).
  2. After quitting and relaunching the app, GHOSTTY_QUICK_TERMINAL is not restored with the panes in the Quick Terminal.

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 GHOSTTY_QUICK_TERMINAL in the split pane scenario (#12895) and delivers a meaningful improvement to the macOS user experience.
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.

@bo2themax
bo2themax merged commit 4df593b into ghostty-org:main Jun 3, 2026
94 checks passed
@github-actions github-actions Bot added this to the 1.4.0 milestone Jun 3, 2026
@bo2themax bo2themax modified the milestones: 1.4.0, 1.3.2 Jun 3, 2026
@mitchellh mitchellh modified the milestones: 1.3.2, 1.4.0 Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MacOS: GHOSTTY_QUICK_TERMINAL not inherited by split panes in Quick Terminal

3 participants