Skip to content

bug: traffic lights jump back to stock position on window resize #395

Description

@yicheng47

Description

The custom titlebar trick repositions the macOS traffic lights by re-framing AppKit's private views: window_set_titlebar_zoom grows the titlebar container to 44px × zoom and re-centers the close/minimize/zoom buttons at x = 16 + index·spacing inside it. AppKit doesn't know about these frames — on window resize it runs its own titlebar layout and resets the container and buttons to their stock geometry, so the traffic lights visibly jump back to the default top-left position.

Nothing re-applies the custom frames on resize. The command only runs at three triggers: app mount (App.tsx:57), zoom change (applyAppZoom), and fullscreen exit (AppShell.tsx:43). After a plain resize the lights stay in the wrong (stock) position until one of those happens.

Expected behavior

Traffic lights stay vertically centered in the custom titlebar at the custom inset through and after window resizes.

Likely fix shape: re-apply the frames when the window resizes — either an AppKit-side observer (NSWindow windowDidResize/live-resize notifications calling the same re-frame routine, which also fixes mid-resize jumping) or, cheaper but flicker-prone, a frontend onResized listener re-invoking window_set_titlebar_zoom. The AppKit-side observer is the correct fix since it catches live-resize layout passes.

Steps to reproduce

  1. Launch the app (traffic lights sit centered in the 44px titlebar).
  2. Drag any window edge/corner to resize.
  3. Traffic lights jump to the macOS default position and stay there.
  4. Change app zoom (⌘+/-) or exit fullscreen — they snap back to the custom position.

Relevant code

  • src-tauri/src/commands/window.rs:148-208window_set_titlebar_zoom: titlebar container re-frame + per-button setFrameOrigin; TRAFFIC_LIGHT_X/TITLEBAR_HEIGHT constants.
  • src/lib/appZoom.ts:19-34syncTitlebarZoom, the only invoke path.
  • src/App.tsx:57 (mount), src/components/AppShell.tsx:43 (fullscreen exit) — the current re-apply triggers; no resize trigger exists.

Environment

  • OS: macOS
  • Version: 0.4.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Annoying — fix when convenientbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions