* Fix transparent background flash during sidebar toggle Move terminal background rendering from the Metal GPU pass to a CALayer (backgroundView). The GPU bg_color pass is disabled via a new Ghostty config flag (macos-background-from-layer). The CALayer resizes instantly with its parent NSView, eliminating the 3-5 frame gap where the desktop was visible through the transparent window during sidebar toggles and layout transitions. Also simplifies the titlebar and sidebar opacity formulas since there is now a single background layer instead of two stacked semi-transparent layers. * Document macos-background-from-layer fork change * Pin GhosttyKit checksum for macos-background-from-layer * Address review feedback: fix fallback config path, inline identity wrapper - Inject macos-background-from-layer in the fallback config path too, preventing alpha double-stacking when user config is invalid - Inline panelBackgroundFillColor (now an identity function) at its two call sites and remove the wrapper * Address adversarial review: skip fullscreen bg draw call explicitly The bg_color uniform alpha is still zeroed for cell compositing (so transparent cells pass through to the CALayer), but the fullscreen background fill draw step is now explicitly skipped instead of relying on alpha=0 as a no-op. * Pin GhosttyKit checksum for bg draw-call skip --------- Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
6.4 KiB
Ghostty Fork Changes (manaflow-ai/ghostty)
This repo uses a fork of Ghostty for local patches that aren't upstream yet. When we change the fork, update this document and the parent submodule SHA.
Fork update checklist
- Make changes in
ghostty/. - Commit and push to
manaflow-ai/ghostty. - Update this file with the new change summary + conflict notes.
- In the parent repo:
git add ghosttyand commit the submodule SHA.
Current fork changes
Fork rebased onto upstream v1.3.0 plus newer main commits as of March 12, 2026.
1) OSC 99 (kitty) notification parser
- Commit:
a2252e7a9(Add OSC 99 notification parser) - Files:
src/terminal/osc.zigsrc/terminal/osc/parsers.zigsrc/terminal/osc/parsers/kitty_notification.zig
- Summary:
- Adds a parser for kitty OSC 99 notifications and wires it into the OSC dispatcher.
2) macOS display link restart on display changes
- Commit:
c07e6c5a5(macos: restart display link after display ID change) - Files:
src/renderer/generic.zig
- Summary:
- Restarts the CVDisplayLink when
setMacOSDisplayIDupdates the current CGDisplay. - Prevents a rare state where vsync is "running" but no callbacks arrive, which can look like a frozen surface until focus/occlusion changes.
- Restarts the CVDisplayLink when
3) Keyboard copy mode selection C API
- Commit:
a50579bd5(Add C API for keyboard copy mode selection) - Files:
src/Surface.zigsrc/apprt/embedded.zig
- Summary:
- Restores
ghostty_surface_select_cursor_cellandghostty_surface_clear_selection. - Keeps cmux keyboard copy mode working against the refreshed Ghostty base.
- Restores
4) macOS resize stale-frame mitigation
Sections 3 and 4 are grouped by feature, not by commit order. The section 4 resize commits were applied earlier than the section 3 copy-mode commit, but they are kept together here because they touch the same stale-frame mitigation path and tend to conflict in the same files during rebases.
- Commits:
769bbf7a9(macos: reduce transient blank/scaled frames during resize)9efcdfdf8(macos: keep top-left gravity for stale-frame replay)
- Files:
pkg/macos/animation.zigsrc/Surface.zigsrc/apprt/embedded.zigsrc/renderer/Metal.zigsrc/renderer/generic.zigsrc/renderer/metal/IOSurfaceLayer.zig
- Summary:
- Replays the last rendered frame during resize and keeps its geometry anchored correctly.
- Reduces transient blank or scaled frames while a macOS window is being resized.
5) zsh prompt redraw markers use OSC 133 P
- Commit:
8ade43ce5(zsh: use OSC 133 P for prompt redraws) - Files:
src/shell-integration/zsh/ghostty-integration
- Summary:
- Emits one
OSC 133;Afresh-prompt mark for real prompt transitions. - Uses
OSC 133;Pmarkers for prompt redraws so async zsh themes do not look like extra prompt lines.
- Emits one
6) zsh Pure-style multiline prompt redraws
- Commits:
0cf559581(zsh: fix Pure-style multiline prompt redraws)312c7b23a(zsh: avoid extra Pure continuation markers)404a3f175(Fix Pure prompt redraw markers)
- Files:
src/shell-integration/zsh/ghostty-integration
- Summary:
- Handles multiline prompts that use
\n%{\r%}to return to column 0 before the visible prompt line. - Keeps redraw-safe prompt-start markers for async themes.
- Avoids inserting an explicit continuation marker after Pure's hidden carriage return, because Ghostty already tracks the newline as prompt continuation and the extra marker duplicates the preprompt row.
- Restores that prompt-marker behavior on top of the current Ghostty
mainbase after the older redraw fix drifted out during later submodule updates.
- Handles multiline prompts that use
The fork branch HEAD is now the section 6 zsh redraw follow-up commit.
7) cmux theme picker helper hooks
- Commit:
0c52c987b(Add cmux theme picker helper hooks) - Files:
build.zigsrc/cli/list_themes.zigsrc/main_ghostty.zig
- Summary:
- Adds a
zig build cli-helperstep so cmux can bundle Ghostty's CLI helper binary on macOS. - Lets
+list-themesswitch into a cmux-managed mode via env vars, writing the cmux theme override file and posting the existing cmux reload notification for live app-wide preview. - Fixes the helper-only
app-runtime=nonestdout path so the Ghostty CLI binary builds with the current Zig toolchain.
- Adds a
The fork branch HEAD is now the section 7 cmux theme picker helper commit.
8) macos-background-from-layer config flag
- Branch:
feat-layer-bg - Files:
src/config/Config.zigsrc/renderer/generic.zig
- Summary:
- Adds a
macos-background-from-layerbool config (default false). - When true, sets
bg_color[3] = 0in the per-frame uniform update so the Metal renderer skips the full-screen background fill. - Allows the host app to provide the terminal background via
CALayer.backgroundColorfor instant coverage during view resizes, avoiding alpha double-stacking.
- Adds a
Upstreamed fork changes
cursor-click-to-move respects OSC 133 click-to-move
- Was local in the fork as
10a585754. - Landed upstream as
bb646926f, so it is no longer carried as a fork-only patch.
Merge conflict notes
These files change frequently upstream; be careful when rebasing the fork:
-
src/terminal/osc/parsers.zig- Upstream uses
std.testing.refAllDecls(@This())intest {}. - Ensure
iterm2import stays, and keepkitty_notificationimport added by us.
- Upstream uses
-
src/terminal/osc.zig- OSC dispatch logic moves often. Re-check the integration points for the OSC 99 parser.
-
src/shell-integration/zsh/ghostty-integration- Prompt marker handling is easy to regress when upstream adjusts zsh redraw behavior. Keep the
OSC 133;AvsOSC 133;Psplit intact for redraw-heavy themes. Pure-style\n%{\r%}prompt newlines should not get an extra explicit continuation marker after the hidden CR.
- Prompt marker handling is easy to regress when upstream adjusts zsh redraw behavior. Keep the
-
src/cli/list_themes.zig- cmux now relies on the upstream picker UI plus local env-driven hooks for live preview and restore. If upstream reorganizes the preview loop or key handling, re-check the cmux mode path and keep the stock Ghostty behavior unchanged when the cmux env vars are absent.
-
src/renderer/generic.zig- The
macos-background-from-layercheck sits next to the glass-style check inupdateFrame. If upstream refactors the bg_color uniform update or the glass conditional, re-check that both paths still zero outbg_color[3]correctly.
- The
If you resolve a conflict, update this doc with what changed.