From 7aef96de21e0a893e1265f56e195b0fe4cf169fc Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 13 Feb 2026 01:03:23 +0900 Subject: [PATCH] feat(window): conditionally set traffic light button position for macOS - Updated the syncTrafficLightPosition function to only call setWindowButtonPosition on macOS, preventing errors on other platforms. - Modified the createWindow function to conditionally include trafficLightPosition based on the operating system. This commit enhances cross-platform compatibility by ensuring macOS-specific functionality is only executed on the appropriate platform. --- src/main/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index d8fcbb95..c62d7ed2 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -324,7 +324,10 @@ function shutdownServices(): void { function syncTrafficLightPosition(win: BrowserWindow): void { const zoomFactor = win.webContents.getZoomFactor(); const position = getTrafficLightPositionForZoom(zoomFactor); - win.setWindowButtonPosition(position); + // setWindowButtonPosition is macOS-only (traffic light buttons) + if (process.platform === 'darwin') { + win.setWindowButtonPosition(position); + } win.webContents.send(WINDOW_ZOOM_FACTOR_CHANGED_CHANNEL, zoomFactor); } @@ -332,6 +335,7 @@ function syncTrafficLightPosition(win: BrowserWindow): void { * Creates the main application window. */ function createWindow(): void { + const isMac = process.platform === 'darwin'; mainWindow = new BrowserWindow({ width: DEFAULT_WINDOW_WIDTH, height: DEFAULT_WINDOW_HEIGHT, @@ -343,7 +347,7 @@ function createWindow(): void { }, backgroundColor: '#1a1a1a', titleBarStyle: 'hidden', - trafficLightPosition: getTrafficLightPositionForZoom(1), + ...(isMac && { trafficLightPosition: getTrafficLightPositionForZoom(1) }), title: 'claude-devtools', });