Skip to content

Commit 46ec3df

Browse files
authored
fix(titlebar): Clear macOS traffic lights via window controls overlay (#3460)
1 parent 7b6010f commit 46ec3df

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

apps/code/src/main/window.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ export function createWindow(): void {
228228
// buttons (40px bar, 24px buttons → centre at y=20; 12px dots → top at 14).
229229
// x mirrors y so the inset from the top and the left match.
230230
trafficLightPosition: { x: 14, y: 14 },
231+
// Exposes the titlebar-area-* CSS env vars so the renderer can
232+
// clear the traffic lights exactly; their size varies by macOS
233+
// version (bigger on Tahoe), so it must not hardcode a width.
234+
titleBarOverlay: true,
231235
}
232236
: process.platform === "win32"
233237
? {

packages/ui/src/router/routes/__root.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import { onFeatureFlagsLoaded } from "@posthog/ui/shell/posthogAnalyticsImpl";
7070
import { SpaceSwitcher } from "@posthog/ui/shell/SpaceSwitcher";
7171
import { useShortcutsSheetStore } from "@posthog/ui/shell/shortcutsSheetStore";
7272
import { openUrlInBrowser } from "@posthog/ui/utils/browser";
73-
import { isWindows } from "@posthog/ui/utils/platform";
73+
import { isMac, isWindows } from "@posthog/ui/utils/platform";
7474
import { getPostHogUrl } from "@posthog/ui/utils/urls";
7575
import { Box, Flex } from "@radix-ui/themes";
7676
import { useQueryClient } from "@tanstack/react-query";
@@ -338,7 +338,9 @@ function RootLayout() {
338338
{/* Full-width title bar: a window-drag region carrying the PostHog
339339
mark. The left section matches the sidebar width so the tab strip
340340
starts flush with the content pane; its padding clears the macOS
341-
stoplights. */}
341+
stoplights via env(titlebar-area-x), the system-reported right
342+
edge of the traffic-light strip (see titleBarOverlay in
343+
window.ts). */}
342344
<Flex
343345
align="center"
344346
className="drag h-10 shrink-0"
@@ -351,8 +353,12 @@ function RootLayout() {
351353
align="center"
352354
justify="between"
353355
gap="3"
354-
className="shrink-0 pr-2 pl-[78px]"
356+
className="shrink-0 pr-2"
355357
style={{
358+
// Traffic-light size varies by macOS version, so a fixed inset
359+
// over- or under-shoots; the env var fallback covers hosts
360+
// without Window Controls Overlay.
361+
paddingLeft: isMac ? "env(titlebar-area-x, 78px)" : "78px",
356362
width: sidebarOpen ? channelsSidebarWidth : undefined,
357363
// Same curve/duration as ResizableSidebar's SLIDE_EASING so the
358364
// title bar tracks the sidebar edge.

0 commit comments

Comments
 (0)