const { app, BrowserWindow } = require('electron'); const path = require('path'); const { registerAll } = require('./ipc'); let mainWindow; function createWindow() { mainWindow = new BrowserWindow({ width: 1200, height: 820, minWidth: 900, minHeight: 600, titleBarStyle: 'hiddenInset', backgroundColor: '#0f0f17', icon: path.join(__dirname, '../../assets/icon.icns'), webPreferences: { preload: path.join(__dirname, '../preload/index.js'), contextIsolation: true, nodeIntegration: false, }, show: false, }); mainWindow.loadFile(path.join(__dirname, '../renderer/index.html')); mainWindow.once('ready-to-show', () => { mainWindow.show(); }); mainWindow.on('enter-full-screen', () => { mainWindow.webContents.send('fullscreen-change', true); }); mainWindow.on('leave-full-screen', () => { mainWindow.webContents.send('fullscreen-change', false); }); } app.whenReady().then(() => { createWindow(); registerAll(mainWindow); }); app.on('window-all-closed', () => { if (process.platform !== 'darwin') app.quit(); }); app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) createWindow(); });