fix: updated UI to macosx conventions

This commit is contained in:
2026-02-17 19:53:27 +01:00
parent a897a35b74
commit 9b54ba6ffb
7 changed files with 161 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import { app, ipcMain, dialog, shell } from 'electron';
import { app, BrowserWindow, ipcMain, dialog, shell } from 'electron';
import * as path from 'path';
import * as fsPromises from 'fs/promises';
import { eq } from 'drizzle-orm';
@@ -697,6 +697,20 @@ export function registerIpcHandlers(): void {
return projectEngine.getDefaultProjectBaseDir(projectId);
});
safeHandle('app:getTitleBarMetrics', async (event) => {
const ownerWindow = BrowserWindow.fromWebContents(event.sender);
const buttonPosition = ownerWindow?.getWindowButtonPosition?.();
if (!buttonPosition) {
return null;
}
const estimatedClusterWidth = Math.max(52, Math.round(buttonPosition.y * 4));
const trailingPadding = Math.max(8, Math.round(buttonPosition.y * 0.6));
const macosLeftInset = Math.max(0, Math.round(buttonPosition.x + estimatedClusterWidth + trailingPadding));
return { macosLeftInset };
});
safeHandle('app:showItemInFolder', async (_, itemPath: string) => {
return shell.showItemInFolder(itemPath);
});