| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import path from 'path';
- import { getBaseDir } from 'ee-core/ps';
- import type { BrowserWindowConstructorOptions } from 'electron';
- /**
- * 主窗口与智能工作台窗口共用的 webPreferences。
- *
- * 两个窗口必须一致:渲染进程目前依赖 nodeIntegration 直接 require('electron') 调 IPC,
- * 智能窗口若单独改成 contextIsolation,现有 preload 又没启用,行为会和主窗口不一致。
- */
- export const sharedWebPreferences = {
- // webSecurity: false,
- contextIsolation: false,
- nodeIntegration: true,
- };
- /** 智能工作台窗口的默认尺寸与下限(bounds 落盘恢复时也按这个下限校验) */
- export const smartWindowSize = {
- width: 1280,
- height: 860,
- minWidth: 1280,
- minHeight: 860,
- };
- /**
- * 智能工作台窗口选项。
- *
- * 刻意不设 parent:Windows 下带 parent 的子窗口会始终悬浮在主窗口之上,
- * 用户无法把主窗口切到前面;VS Code 的 Agents window 也是独立顶层窗口。
- */
- export function getSmartWindowOptions(): BrowserWindowConstructorOptions {
- return {
- title: '清鉴 · 智能工作台',
- ...smartWindowSize,
- webPreferences: { ...sharedWebPreferences },
- frame: false,
- show: false,
- backgroundColor: '#ffffff',
- icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
- };
- }
|