Skip to content

Inset the macOS window buttons inside the glass sidebar - #5529

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/macos-titlebar-row-traffic-lights
Oct 16, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/macos-titlebar-row-traffic-lights

Conversation

@mlandry-devolutions

@mlandry-devolutions Maxime Landry (mlandry-devolutions) commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • Have you confirmed that this issue is caused by UniGetUI itself, and not by the package manager or the package involved?

With the macOS glass look (#5511) the sidebar floats in a rounded panel 8 pt from the window edges, but macOS keeps the close/minimise/zoom buttons at the bare title-bar position, 7 pt from the edge: the red button sits on the panel's rounded corner. The back and sidebar buttons were placed with fixed values (traffic lights centred at 14 pt, 76 pt inset) measured before macOS 26 and the glass sidebar, so they ended up 8 pt from the zoom button and 2 pt above the traffic lights.

  • Read the real position: MacGlassWindowHelper.GetZoomButtonFrame reads where macOS placed the zoom button, and the back/sidebar row aligns to its centre line, 14 pt after it. The previous constants remain as a fallback. Each new frame is logged once, to help diagnose other macOS versions.
  • Inset the window buttons: MacGlassWindowHelper.SetWindowButtonsPosition moves them inside the glass panel (red button 20 pt from the edge, centred on the 44 pt bar, the search field's line), like System Settings. Same technique as Electron's trafficLightPosition: the title-bar container is resized and the buttons repositioned, re-applied on resize, zoom and state changes because macOS lays them out again.
  • Uses the same LibraryImport AppKit interop as the glass helper: no reflection, AOT-safe; NSRect returns go through objc_msgSend_stret on x64. Full screen is unchanged.

Tested on macOS 26.7.1 (Apple Silicon, normal window): the zoom button moves from x = 47, y = 6 to x = 60, y = 14, and the back/sidebar buttons follow. Not yet checked: maximized window, leaving full screen, Intel Mac.


Relates to UNI-36

🤖 Generated with Claude Code

…laces the window buttons

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the title bar's centre line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Native title-bar changes still need validation on Intel Macs, maximize/fullscreen transitions, and published NativeAOT builds.

0 open findings

What changed in this PR

Refines the macOS glass sidebar introduced in #5511 by moving native window buttons inside the panel and aligning navigation controls with them.

Changes:

  • Adds native button positioning and frame measurement with architecture-specific interop.
  • Reapplies alignment on window changes, retaining fallback positions and logging frame changes.
File Description
src/​UniGetUI.Avalonia/​Views/​MainWindow.axaml.cs Aligns title-bar controls and refreshes positioning on window changes.
src/​UniGetUI.Avalonia/​Infrastructure/​MacGlassWindowHelper.cs Adds AppKit helpers to measure and reposition native window buttons.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit fd1cb3b into main Oct 16, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/macos-titlebar-row-traffic-lights branch October 16, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants