Skip to content

Fix sidebar tint transparency backdrop ownership - #3382

Merged
lawrencecchen merged 6 commits into
mainfrom
feat-transparency-tint-logs
May 1, 2026
Merged

lawrencecchen merged 6 commits into
mainfrom
feat-transparency-tint-logs

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • centralize window backdrop selection in WindowBackdropPlan / WindowBackdropController
  • keep sidebar tint and terminal background opacity as separate surface backdrops
  • reinstall command palette, tmux, and drop overlays into the stable window content overlay target after glass root changes

Tests

  • xcodebuild test -project GhosttyTabs.xcodeproj -scheme cmux-unit -destination 'platform=macOS' -only-testing:cmuxTests/WindowAppearanceSnapshotTests -derivedDataPath /tmp/cmux-transparency-pr-test
  • ./scripts/reload.sh --tag transfix

Summary by CodeRabbit

  • Refactor
    • Centralized window backdrop system that standardizes transparency, tint, and glass behavior; backdrop updates now drive overlay/geometry sync.
    • Unified overlay targeting for improved positioning, edge constraints, and hit-testing across palettes, panes, and file-drop overlays.
    • Sidebar visual-effect opacity now clamped and applied more reliably.
  • Tests
    • Added new snapshot tests validating backdrop hosting phases and policies; removed outdated snapshot tests.

@vercel

vercel Bot commented May 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment May 1, 2026 6:45am
cmux-staging Building Building Preview, Comment May 1, 2026 6:45am

@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a44f96df-07e9-4748-97d3-b2dabef72460

📥 Commits

Reviewing files that changed from the base of the PR and between 4437aba and a3763d9.

📒 Files selected for processing (1)
  • cmuxTests/WindowAppearanceSnapshotTests.swift

📝 Walkthrough

Walkthrough

Centralizes window backdrop and glass-effect logic into a WindowBackdropController with plan-based snapshots, switches overlay installation/hit-testing to a container/reference targeting model, updates overlay controllers and file-drop overlay attachment accordingly, and adds/adjusts tests and project entries.

Changes

Cohort / File(s) Summary
Backdrop controller & snapshot types
Sources/Windowing/WindowBackdropController.swift, Sources/Windowing/WindowAppearanceSnapshot.swift, GhosttyTabs.xcodeproj/project.pbxproj
Adds WindowBackdropController and plan/hosting-phase types; extends WindowAppearanceSnapshot with construction, mutation ID, hosting decision, and backdropPlan helpers; registers new source and test files in the Xcode project.
Window background application
Sources/GhosttyTerminalView.swift, Sources/cmuxApp.swift
Replaces local clear-vs-default background branching with snapshot → backdropPlan → WindowBackdropController.apply pipeline; routes debug tint updates via WindowBackdropController.updateGlassTint; widens cmuxTransparentWindowBaseColor() visibility.
Overlay installation & hit‑testing
Sources/ContentView.swift
Adds windowContentOverlayInstallationTarget(for:) returning (container, reference) and updates Command Palette, Tmux workspace pane, and file-drop overlay controllers to store/install overlays using container/reference, constrain overlays to reference bounds, and perform hit-testing against container.
File‑drop & overlay refactor
Sources/... (file-drop and overlay controller changes in ContentView and overlay controllers)
Refactors file-drop overlay attachment and constraint verification to use containerView + referenceView from helper; overlays are reinstalled only when target views change and geometry sync is scheduled when the glass root changes.
Tests
cmuxTests/GhosttyConfigTests.swift, cmuxTests/WindowAppearanceSnapshotTests.swift
Removes old WindowAppearanceSnapshot tests from GhosttyConfigTests; adds WindowAppearanceSnapshotTests.swift validating backdrop policies, hosting phases, glass behavior, mutation ID stability, and snapshot permutations.
Miscellaneous cleanup
Sources/ContentView.swift, other touched files
Removes makeViewHierarchyTransparent(_), clamps sidebar visual-effect opacity to [0,1], and routes all backdrop apply/remove through WindowBackdropController instead of prior branching.

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant CV as ContentView
    participant GTV as GhosttyTerminalView
    participant WAS as WindowAppearanceSnapshot
    participant WBC as WindowBackdropController
    participant NSW as NSWindow
    participant WGE as WindowGlassEffect

    App->>WAS: currentFromUserDefaults(...)
    WAS-->>App: WindowAppearanceSnapshot
    App->>WAS: backdropPlan(...)
    WAS-->>App: WindowBackdropPlan

    App->>WBC: apply(snapshot:to:window)
    WBC->>WBC: compute hostingPhase & plan
    WBC->>NSW: set backgroundColor / isOpaque
    alt plan.useWindowGlass
        WBC->>WGE: install/update glass effect (tint/style)
    else
        WBC->>WGE: remove glass effect if present
    end
    WBC-->>App: WindowBackdropApplicationResult

    CV->>CV: windowContentOverlayInstallationTarget(for:)
    CV-->>CV: (containerView, referenceView)
    CV->>CV: install overlays constrained to referenceView bounds
    CV->>CV: hit-test overlays against containerView

    GTV->>WBC: apply(snapshot:to:itsWindow)
    WBC->>NSW: reflect hostingPhase on window
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 I hopped through panes and glass so bright,
I stitched the tints and planned the light,
One controller hums, the overlays nest,
Containers, references all at rest,
A rabbit cheers — backdrops set right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix sidebar tint transparency backdrop ownership' is specific and directly related to the main objective of centralizing backdrop selection and keeping sidebar tint as a separate surface backdrop.
Description check ✅ Passed The PR description includes a summary of changes and testing approach, though it lacks some template sections like demo video, review trigger, and a formal checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-transparency-tint-logs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 14 minutes and 49 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralizes window backdrop selection into WindowBackdropPlan / WindowBackdropController, replacing scattered inline window.isOpaque / window.backgroundColor mutations across ContentView, GhosttyTerminalView, and GhosttyApp. It also re-installs command palette, tmux, and file-drop overlays into the stable glass foreground container after glass root changes, and adds extensive #if DEBUG tracing throughout the sidebar appearance and glass effect paths.

Confidence Score: 4/5

Safe to merge; only P2 findings around a dead stub property and a theoretical unhandled struct combination

All findings are P2. The refactoring is well-structured and the new plan-based backdrop system is a clear improvement. The two P2 issues — a dead shouldClearContentViewHierarchy stub and a silently-no-op .windowGlass + glass: nil combination — are not reachable from production code paths today.

Sources/Windowing/WindowAppearanceSnapshot.swift — shouldClearContentViewHierarchy stub and .windowGlass branch in WindowBackdropController.apply

Important Files Changed

Filename Overview
Sources/Windowing/WindowAppearanceSnapshot.swift Introduces WindowBackdropPlan, WindowBackdropController, and currentFromUserDefaults — well-structured refactoring; shouldClearContentViewHierarchy is a dead stub (always false, never consumed)
Sources/ContentView.swift Centralizes overlay installation via windowContentOverlayInstallationTarget, re-installs overlays on glass root changes, removes makeViewHierarchyTransparent; logic is clean
Sources/GhosttyTerminalView.swift Replaces inline transparent/opaque window decisions with WindowBackdropController.apply; promotes cmuxTransparentWindowBaseColor to internal visibility for reuse
Sources/Windowing/WindowGlassEffect.swift Renames portalInstallationTarget to contentOverlayInstallationTarget with a backward-compat wrapper; adds #if DEBUG logging throughout; no logic changes
Sources/cmuxApp.swift Adds debug-only logSidebarAppearanceSettingsChange helpers and wraps sidebar settings UI bindings in logging shims; routes glass tint update through WindowBackdropController
Sources/GhosttyConfig.swift Adds #if DEBUG logging for sidebar appearance config application; no functional changes
cmuxTests/GhosttyConfigTests.swift Adds four new WindowBackdropPlan tests and extends makeSnapshot/assertTerminalBackdrop; shouldClearContentViewHierarchy assertions will always pass since the property is hardcoded to false

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[WindowAppearanceSnapshot] -->|backdropPlan| B[WindowBackdropPlan]
    B --> C{hostingPhase}
    C -->|opaqueWindowFill| D[remove glass\nset opaque background]
    C -->|transparentRootBackdrop| E[remove glass\nclear background\napply blur if needed]
    C -->|windowGlass| F[apply WindowGlassEffect\nclear background]
    F -->|didChangeGlassRoot| G[re-install overlays]
    G --> H{glass active?}
    H -->|yes| I[container = foregroundContainer\nreference = originalContentView]
    H -->|no| J[container = themeFrame\nreference = contentView]
Loading

Comments Outside Diff (1)

  1. Sources/Windowing/WindowAppearanceSnapshot.swift, line 653-663 (link)

    P2 .windowGlass with glass: nil silently leaves existing glass root in place

    When plan.hostingPhase == .windowGlass but plan.glass == nil, the apply method skips the WindowGlassEffect.apply call and also never calls WindowGlassEffect.remove, so any previously-installed native or fallback glass root remains active. backdropPlan() always provides a non-nil glass value when hostingPhase == .windowGlass, so this can't be triggered today. However, the struct allows the combination, and any future caller constructing a WindowBackdropPlan manually (or via apply(snapshot:to:)) could hit this silently. Adding a call to WindowGlassEffect.remove(from: window) at the top of the .windowGlass branch before the if let glass guard would close this gap safely, since apply is idempotent anyway.

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment thread Sources/Windowing/WindowAppearanceSnapshot.swift Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Sources/ContentView.swift (1)

1267-1287: 💤 Low value

Minor inconsistency: No debug logging in TmuxWorkspacePaneOverlayController.ensureInstalled.

CommandPaletteOverlayController logs overlay installation details at lines 792-798, but this controller does not. Consider adding equivalent debug logging for consistency in diagnosing overlay installation issues.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 1267 - 1287, Add debug logging to
ensureInstalled in TmuxWorkspacePaneOverlayController (the ensureInstalled()
method) to mirror CommandPaletteOverlayController's install logs: when
early-returning because window or target is missing, log that installation
failed with window/target state; before changing parents (when
containerView.superview !== target.container || installedReferenceView !==
target.reference), log the target.container and target.reference and the current
installedReferenceView; and after activating installConstraints and setting
installedReferenceView, log successful installation details. Use the same logger
and log level used by CommandPaletteOverlayController so messages are consistent
with existing installation logs and reference the symbols ensureInstalled,
windowContentOverlayInstallationTarget(for:), installConstraints, containerView,
installedReferenceView, and target.reference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Sources/ContentView.swift`:
- Around line 1267-1287: Add debug logging to ensureInstalled in
TmuxWorkspacePaneOverlayController (the ensureInstalled() method) to mirror
CommandPaletteOverlayController's install logs: when early-returning because
window or target is missing, log that installation failed with window/target
state; before changing parents (when containerView.superview !==
target.container || installedReferenceView !== target.reference), log the
target.container and target.reference and the current installedReferenceView;
and after activating installConstraints and setting installedReferenceView, log
successful installation details. Use the same logger and log level used by
CommandPaletteOverlayController so messages are consistent with existing
installation logs and reference the symbols ensureInstalled,
windowContentOverlayInstallationTarget(for:), installConstraints, containerView,
installedReferenceView, and target.reference.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3cddffcf-85b1-4aa6-9b52-731175fc291c

📥 Commits

Reviewing files that changed from the base of the PR and between a9a7feb and a2719de.

📒 Files selected for processing (7)
  • Sources/ContentView.swift
  • Sources/GhosttyConfig.swift
  • Sources/GhosttyTerminalView.swift
  • Sources/Windowing/WindowAppearanceSnapshot.swift
  • Sources/Windowing/WindowGlassEffect.swift
  • Sources/cmuxApp.swift
  • cmuxTests/GhosttyConfigTests.swift

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmuxTests/WindowAppearanceSnapshotTests.swift`:
- Around line 55-60: The test is non-deterministic because
shouldUseTransparentHosting() and windowGlassSettings.shouldApply() read the
runtime WindowGlassEffect.isAvailable default while the assertion on
backdropPlan passes glassEffectAvailable: true; make the test deterministic by
forcing glass availability for the assertions: either set
WindowGlassEffect.isAvailable = true at the start of the test (and restore it
after) or, if available, call the variants that accept a glassEffectAvailable
parameter (e.g., snapshot.shouldUseTransparentHosting(glassEffectAvailable:
true) and snapshot.windowGlassSettings.shouldApply(glassEffectAvailable: true));
update the assertions to use the same glassEffectAvailable: true so all branches
exercise the glass-clear path consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15aba44f-643f-4eab-91b6-c27f9c6a4b9e

📥 Commits

Reviewing files that changed from the base of the PR and between a2719de and 5fdf034.

📒 Files selected for processing (7)
  • GhosttyTabs.xcodeproj/project.pbxproj
  • Sources/ContentView.swift
  • Sources/Windowing/WindowAppearanceSnapshot.swift
  • Sources/Windowing/WindowBackdropController.swift
  • Sources/cmuxApp.swift
  • cmuxTests/GhosttyConfigTests.swift
  • cmuxTests/WindowAppearanceSnapshotTests.swift
💤 Files with no reviewable changes (1)
  • cmuxTests/GhosttyConfigTests.swift
✅ Files skipped from review due to trivial changes (1)
  • Sources/cmuxApp.swift

Comment thread cmuxTests/WindowAppearanceSnapshotTests.swift Outdated
@lawrencecchen
lawrencecchen merged commit 6df97b5 into main May 1, 2026
23 checks passed
@lawrencecchen
lawrencecchen deleted the feat-transparency-tint-logs branch May 1, 2026 06:57

This branch was successfully deployed

1 active deployment
Preview – cmux — a3763d93 Deployed May 1, 2026 by vercel[bot]
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.

1 participant