Skip to content

Commit dbd985d

Browse files
authored
fix: traffic light position on macOS 26 (#281620)
1 parent b4a9be4 commit dbd985d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/vs/platform/windows/electron-main/windowImpl.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,11 @@ export abstract class BaseWindow extends Disposable implements IBaseWindow {
420420

421421
// macOS: update window controls via setWindowButtonPosition()
422422
else if (isMacintosh && options.height !== undefined) {
423-
// The traffic lights have a height of 12px. There's an invisible margin
424-
// of 2px at the top and bottom, and 1px on the left and right. Therefore,
425-
// the height for centering is 12px + 2 * 2px = 16px. When the position
426-
// is set, the horizontal margin is offset to ensure the distance between
427-
// the traffic lights and the window frame is equal in both directions.
428-
const offset = Math.floor((options.height - 16) / 2);
423+
// When the position is set, the horizontal margin is offset to ensure
424+
// the distance between the traffic lights and the window frame is equal
425+
// in both directions.
426+
const buttonHeight = isTahoeOrNewer(release()) ? 14 : 16;
427+
const offset = Math.floor((options.height - buttonHeight) / 2);
429428
if (!offset) {
430429
win.setWindowButtonPosition(null);
431430
} else {

0 commit comments

Comments
 (0)