Suppress native proxy icon on cmux main windows

Merged
LA
6mo ago
+386-14

Fixes https://github.com/manaflow-ai/cmux/issues/3928

Summary

  • Add a regression test covering the cmux main-window invariant that native NSWindow.representedURL is suppressed.
  • Suppress AppKit's native proxy icon on CmuxMainWindow so Ghostty cwd updates cannot create an independently-positioned folder icon.
  • Keep cmux's existing custom titlebar folder icon as the sole visible directory icon, so it stays in the same layout row as the workspace title and follows sidebar layout changes.

Observed vs Expected

  • Observed: with a long title such as cmux52: #3904 ime-arrow-keys, the AppKit proxy folder icon from NSWindow.representedURL can remain at a fixed native titlebar position and visually overlap the title text, especially when the left sidebar changes the custom titlebar layout.
  • Expected: the folder icon sits adjacent to the title and moves with the cmux titlebar layout instead of being embedded mid-string.

Notes

I could not reproduce the overlap consistently on the current local Nightly build, but the root cause is the split ownership: Ghostty sets representedURL on the NSWindow, while cmux draws its own sidebar-aware titlebar and directory icon. This PR makes the cmux main window reject the native proxy URL so AppKit no longer draws the conflicting icon.

Testing

  • Not run locally per repo/user instruction; CI should run the regression test.

[!NOTE]
Medium Risk
Touches AppKit window/titlebar behavior and adds notification-driven frame syncing, which could have subtle UI regressions or performance implications across window/layout changes.

Overview
Prevents AppKit from ever showing a native titlebar proxy icon on CmuxMainWindow by overriding representedURL/representedFilename to always clear them (with a re-entrancy guard), ensuring only cmux’s custom titlebar folder icon is visible.

Improves the detached folder-drag icon panel so it reliably follows layout changes: standardizes icon sizing/spacing via TitlebarFolderIconMetrics, and updates the detached panel’s frame not just on window moves but also on host/ancestor view frame/bounds changes (coalesced to the next run loop).

Adds regression tests for proxy-icon suppression, detached panel tracking under host/ancestor movement, and a focus-regain redraw invalidation path.

Reviewed by Cursor Bugbot for commit b9054cffd269fc718491fa1b85cd403aa614ec8b. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Suppress the native AppKit proxy folder icon on CmuxMainWindow and keep the custom titlebar folder icon aligned with the title and sidebar. Also fixes global search labeling for right‑sidebar tool panels.

  • Bug Fixes
    • Prevent AppKit’s proxy icon by clearing representedURL/representedFilename on CmuxMainWindow with a re-entrancy guard.
    • Keep the custom folder icon aligned by centralizing metrics and syncing the detached drag panel with host moves, frame replacements, and ancestor layout changes (coalesced). Adds tests for proxy suppression, panel tracking, and key-regain redraw.
    • Global search: treat rightSidebarTool as a title document to fix result labeling.

Summary by CodeRabbit

  • Bug Fixes

    • Suppresses the system workspace proxy icon in the custom titlebar to prevent an unwanted native icon.
  • UI / Layout

    • Centralized folder-icon sizing and spacing for consistent titlebar appearance.
    • Detached folder-drag icon sizing standardized and now reliably tracks host and ancestor moves and layout changes.
  • Tests

    • Added tests for proxy icon suppression, detached-icon positioning, and window focus/redraw behavior.

Review Change Stack

Closes #3928