- What: Simple
titlebarAppearsTransparentandtitleVisibilitytoggle - Issue: Window content area shrinks when title bar is hidden, causing visual jump
- What: Added 28px spacer at top when title bar hidden to compensate for lost space
- Issue: Content still jumps down, padding approach doesn't solve the core window sizing issue
- What: Expand window height downward by title bar height when hiding
- Issue: Window grows larger than original size, not maintaining total window bounds
- What: Move window up by title bar height and expand height to maintain content position
- Issue: Window moves up on screen, changing its position relative to other windows
- What: Keep same window height, only adjust Y position up/down by title bar height
- Issue: Window "pops" up and down on screen, changing its absolute position
- What: Shrink height by title bar amount and move up to maintain total window bounds
- Issue: Content area gets smaller instead of larger, defeating the purpose
- What: Only toggle title bar properties without any frame manipulation
- Result: Let macOS handle the natural behavior
- Store window frame before any title bar changes
- Restore exact frame when toggling back
- May help with precise positioning
- Implement
NSWindowDelegatemethods likewindowWillResizeorwindowDidResize - Override automatic frame adjustments during title bar changes
- Create custom
NSWindowsubclass with overridden frame calculation methods - More control over how window responds to style mask changes
- Apply title bar changes first
- Use
DispatchQueue.main.asyncto adjust frame after style changes settle - May avoid timing conflicts with macOS automatic adjustments
- Try
window.titlebarAppearsTransparent = truewith.unifiedstyle - Different approach to title bar integration
- Instead of window frame changes, adjust content view margins/padding
- Keep window frame constant, only change internal layout
- Track text editor scroll position before toggle
- Restore exact scroll position after toggle to minimize visual disruption
- What: Capture window frame before first hide, restore to it when showing
- Issue: First hide perfect, first show perfect, then growing/shrinking begins
- Problem: Baseline captured at wrong time or frame restoration interferes with natural flow
- What: Let first hide/show cycle happen naturally, only intervene after
- Logic: Since first two operations are perfect, capture "good" state after first show
- Implementation: Skip frame manipulation for first cycle, capture baseline after first show completes
- What: Calculate based on content area rather than window frame
- Logic: Title bar changes affect content area, work with that instead of total frame
- What: Track operation count and behavior differently for each phase
- States: Initial (let natural), Post-first-cycle (intervene), Stable (maintain)
- First hide: ✅ Perfect (natural macOS behavior)
- First show: ✅ Perfect (baseline restoration works)
- Second hide: ❌ Shrinks by title bar height
- Second show: ❌ Grows by title bar height
- Key insight: Problem starts after first successful hide/show cycle
The issue appears to be that:
- Our baseline capture includes title bar area incorrectly
- Or the window state after first restoration is corrupted
- Or we're interfering with macOS's natural second-cycle behavior
- The "perfect" frame might be the one AFTER first show, not before first hide
- macOS calculates window position from bottom-left corner
- Title bar height ≈ 28px on modern macOS
fullSizeContentViewstyle mask affects how content area is calculated- First two operations work perfectly - preserve this behavior