Skip to content

fix: position window beside tray on left taskbars#15

Open
afonsojramos wants to merge 1 commit into
mainfrom
fix/window-position-left-taskbar
Open

fix: position window beside tray on left taskbars#15
afonsojramos wants to merge 1 commit into
mainfrom
fix/window-position-left-taskbar

Conversation

@afonsojramos
Copy link
Copy Markdown
Member

Summary

When the OS taskbar is anchored to the left edge of the screen, getWindowPosition returned 'bottomLeft', which puts the menubar window in the screen's bottom-left corner — visually disconnected from the tray icon. This PR switches that branch to 'leftCenter' so the window sits vertically centered against the left work-area edge, much closer to where the tray icon actually lives.

Why this design over upstream's

The motivating bug was reported in upstream max-mapper/menubar#293 by @thomasdarde, who patched the (then-current) 'trayBottomLeft' to 'center'. Their own commit message says it best: "It's not perfect, but at least not broken."

The fork has since moved the value to 'bottomLeft' (which avoids clipping under the taskbar — bottomLeft reads from workArea.x, not tray.x), but the window still pops up far from the tray.

Option Clips under taskbar? Close to tray?
trayBottomLeft (old upstream) ✅ Yes, x reads from tray.x ≈ 0
bottomLeft (current main) ❌ No ❌ No, window appears at screen bottom
center (upstream max-mapper#293) ❌ No ❌ No, window appears mid-screen
leftCenter (this PR) ❌ No ✅ Vertically centered on the left edge — same strip as the tray

leftCenter resolves to { x: workArea.x, y: workArea.height / 2 - windowHeight / 2 } in Positioner, so the left edge sits flush against the work area (no clipping) and the window is vertically anchored to the centre of the strip where the tray lives.

This isn't pixel-perfect tray anchoring — Positioner doesn't have a side-taskbar tray-anchored option — but it's strictly better than the alternatives.

Test plan

  • bun run test — 62/62 pass
  • bun run typecheck — clean
  • bun run lint:check — clean (one pre-existing warning, unrelated)
  • Manual: would benefit from real-world verification on a left-side Windows taskbar. The CI tray-rendering matrix covers Linux DEs but not (yet) left-anchored variants.

Closes the gap from upstream max-mapper/menubar#293.

`bottomLeft` placed the menubar window in the screen's bottom-left
corner — visually disconnected from the tray icon, which lives on the
left strip. Use `leftCenter` so the window sits vertically centered
against the left work-area edge, much closer to where the tray icon
actually is.

Picks up the bug originally reported in upstream
max-mapper#293 by @thomasdarde. Upstream proposed `center`;
`leftCenter` stays anchored to the side where the tray lives and is
strictly better than both `bottomLeft` and `center`.
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.

1 participant