MCPcopy Create free account
hub / github.com/agent-tower/core / createWindow

Function createWindow

packages/desktop/src/main.ts:464–525  ·  view source on GitHub ↗
(baseUrl: string)

Source from the content-addressed store, hash-verified

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

Callers 1

main.tsFile · 0.85

Calls 5

logMemorySnapshotFunction · 0.85
setMethod · 0.80
onceMethod · 0.80
logFunction · 0.70
onMethod · 0.45

Tested by

no test coverage detected