···1414import { initTray } from './tray.js';
1515import { registerLocalShortcut, unregisterLocalShortcut, handleLocalShortcut, registerGlobalShortcut, unregisterGlobalShortcut, unregisterShortcutsForAddress } from './shortcuts.js';
1616import { scopes, publish, subscribe, setExtensionBroadcaster, getSystemAddress } from './pubsub.js';
1717-import { APP_DEF_WIDTH, APP_DEF_HEIGHT, WEB_CORE_ADDRESS, getPreloadPath, isTestProfile } from './config.js';
1717+import { APP_DEF_WIDTH, APP_DEF_HEIGHT, WEB_CORE_ADDRESS, getPreloadPath, isTestProfile, isHeadless } from './config.js';
1818import { addEscHandler, winDevtoolsConfig, closeOrHideWindow } from './windows.js';
19192020// Configuration
···378378 const win = new BrowserWindow(winPrefs);
379379 win.loadURL(WEB_CORE_ADDRESS);
380380381381- // Setup devtools for the background window (debug mode, but not in tests)
382382- if (config.isDev && !isTestProfile()) {
381381+ // Setup devtools for the background window (debug mode, but not in tests or headless)
382382+ if (config.isDev && !isTestProfile() && !isHeadless()) {
383383 win.webContents.openDevTools({ mode: 'detach', activate: false });
384384 }
385385···417417 const existingWindow = findWindowByKey(WEB_CORE_ADDRESS, featuresMap.key as string);
418418 if (existingWindow) {
419419 console.log('Reusing existing window with key:', featuresMap.key);
420420- existingWindow.window.show();
420420+ if (!isHeadless()) {
421421+ existingWindow.window.show();
422422+ }
421423 return { action: 'deny' as const };
422424 }
423425 }
···427429 ...(featuresMap as Electron.BrowserWindowConstructorOptions),
428430 width: parseInt(String(featuresMap.width)) || APP_DEF_WIDTH,
429431 height: parseInt(String(featuresMap.height)) || APP_DEF_HEIGHT,
430430- show: featuresMap.show !== false,
432432+ show: isHeadless() ? false : featuresMap.show !== false,
431433 webPreferences: {
432434 preload: preloadPath
433435 }
+3-2
backend/electron/windows.ts
···99 WEB_CORE_ADDRESS,
1010 SETTINGS_ADDRESS,
1111 isTestProfile,
1212+ isHeadless,
1213} from './config.js';
1314import {
1415 getWindowInfo,
···123124124125 console.log('winDevtoolsConfig:', bw.id, 'openDevTools:', params.openDevTools, 'address:', params.address);
125126126126- // Check if devTools should be opened (never in test profiles)
127127- if (params.openDevTools === true && !isTestProfile()) {
127127+ // Check if devTools should be opened (never in test profiles or headless mode)
128128+ if (params.openDevTools === true && !isTestProfile() && !isHeadless()) {
128129 const isDetached = params.detachedDevTools === true;
129130 // Determine if detached mode should be used
130131 // activate: false prevents devtools from stealing focus (only works with detach/undocked)