Files
aryx/src/main/windows/createMainWindow.ts
T
David KayaandCopilot e37d69bd63 fix: add macOS traffic light inset to sidebar header
Position macOS traffic light buttons (trafficLightPosition) in the
BrowserWindow and add conditional left padding to the sidebar header
so the app logo and title clear the window management controls.

- Create shared platform detection utility (src/renderer/lib/platform.ts)
- Set trafficLightPosition { x: 16, y: 22 } on macOS in createMainWindow
- Apply pl-20 (80px) left padding to the sidebar header on macOS
- Consolidate navigator.platform check from keyboardShortcuts.ts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-30 16:04:45 +01:00

54 lines
1.3 KiB
TypeScript

import electron from 'electron';
import type { BrowserWindow as BrowserWindowType } from 'electron';
import { join } from 'node:path';
import { resolveWindowIconPath } from '@main/windows/appIcon';
const { app, BrowserWindow, Menu, shell } = electron;
export function createMainWindow(): BrowserWindowType {
Menu.setApplicationMenu(null);
const window = new BrowserWindow({
width: 1440,
height: 960,
minWidth: 1120,
minHeight: 720,
title: 'aryx',
icon: resolveWindowIconPath({
appPath: app.getAppPath(),
platform: process.platform,
}),
backgroundColor: '#09090b',
titleBarStyle: 'hidden',
...(process.platform === 'darwin' && {
trafficLightPosition: { x: 16, y: 22 },
}),
titleBarOverlay: {
color: '#09090b',
symbolColor: '#a1a1aa',
height: 32,
},
webPreferences: {
preload: join(__dirname, '../preload/index.js'),
contextIsolation: true,
nodeIntegration: false,
},
});
const rendererUrl = process.env.ELECTRON_RENDERER_URL;
if (rendererUrl) {
void window.loadURL(rendererUrl);
} else {
void window.loadFile(join(__dirname, '../../dist/renderer/index.html'));
}
window.webContents.setWindowOpenHandler(({ url }) => {
void shell.openExternal(url);
return { action: 'deny' };
});
return window;
}