| 462 | const usesIntegratedTitlebar = usesMacIntegratedTitlebar || usesWindowsIntegratedTitlebar; |
| 463 | const appUrl = new URL(baseUrl); |
| 464 | appUrl.searchParams.set('desktop', '1'); |
| 465 | appUrl.searchParams.set('desktopPlatform', process.platform); |
| 466 | if (usesIntegratedTitlebar) { |
| 467 | appUrl.searchParams.set('desktopTitlebar', 'integrated'); |
| 468 | } |
| 469 | |
| 470 | const window = new BrowserWindow({ |
| 471 | width: 1440, |
| 472 | height: 960, |
| 473 | minWidth: 1024, |
| 474 | minHeight: 720, |
| 475 | title: 'Agent Tower', |
| 476 | autoHideMenuBar: !usesMacIntegratedTitlebar, |
| 477 | ...(usesMacIntegratedTitlebar |
| 478 | ? { |
| 479 | titleBarStyle: 'hiddenInset' as const, |
| 480 | trafficLightPosition: { x: 14, y: 14 }, |
| 481 | } |
| 482 | : {}), |
| 483 | ...(usesWindowsIntegratedTitlebar |
| 484 | ? { |
| 485 | titleBarStyle: 'hidden' as const, |
| 486 | titleBarOverlay: { |
| 487 | color: '#fafafa', |
| 488 | symbolColor: '#52525b', |
| 489 | height: 48, |
| 490 | }, |
| 491 | } |
| 492 | : {}), |
| 493 | backgroundColor: '#0f0f10', |
| 494 | webPreferences: { |
| 495 | contextIsolation: true, |
| 496 | nodeIntegration: false, |
| 497 | sandbox: true, |
| 498 | }, |
| 499 | }); |
| 500 | |
| 501 | if (!usesMacIntegratedTitlebar && app.isPackaged) { |
| 502 | window.setMenu(null); |
| 503 | } |
| 504 | |
| 505 | window.on('closed', () => { |
| 506 | if (mainWindow === window) { |
| 507 | mainWindow = null; |
| 508 | } |
| 509 | }); |
| 510 | |
| 511 | void window.loadURL(appUrl.toString()); |
| 512 | window.webContents.once('did-finish-load', () => { |
| 513 | log(`Loaded Agent Tower UI: ${appUrl.toString()}`); |
| 514 | setTimeout(() => { |
| 515 | void logMemorySnapshot(); |
| 516 | }, 1_000); |
| 517 | }); |
| 518 | |
| 519 | return window; |
| 520 | } |
| 521 | |