51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
const { app, BrowserWindow, Menu } = require('electron');
|
|
const path = require('path');
|
|
|
|
// 与 package.json 的 build.appId 保持一致:
|
|
// Windows 靠 AppUserModelID 做任务栏图标归组与通知身份识别,不设置会出现"图标分身"。
|
|
if (process.platform === 'win32') {
|
|
app.setAppUserModelId('com.ttstd.director-desk');
|
|
}
|
|
|
|
Menu.setApplicationMenu(null);
|
|
|
|
let mainWindow;
|
|
|
|
function createWindow() {
|
|
mainWindow = new BrowserWindow({
|
|
width: 1400,
|
|
height: 900,
|
|
minWidth: 1200,
|
|
minHeight: 800,
|
|
title: 'StoryAI 3D Director Desk',
|
|
webPreferences: {
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
},
|
|
autoHideMenuBar: true,
|
|
});
|
|
|
|
if (app.isPackaged) {
|
|
mainWindow.loadFile(path.join(__dirname, '../dist/index.html'));
|
|
} else {
|
|
mainWindow.loadURL('http://localhost:5173');
|
|
mainWindow.webContents.openDevTools();
|
|
}
|
|
|
|
mainWindow.on('closed', () => {
|
|
mainWindow = null;
|
|
});
|
|
}
|
|
|
|
app.whenReady().then(createWindow);
|
|
|
|
app.on('window-all-closed', () => {
|
|
app.quit();
|
|
});
|
|
|
|
app.on('activate', () => {
|
|
if (mainWindow === null) {
|
|
createWindow();
|
|
}
|
|
});
|