const { app, BrowserWindow, ipcMain, dialog } = require('electron'); const path = require('path'); let mainWindow; function createWindow() { mainWindow = new BrowserWindow({ width: 800, height: 600, frame: false, transparent: true, webPreferences: { preload: path.join(__dirname, 'preload.js'), nodeIntegration: false, contextIsolation: true }, resizable: false, center: true, show: false }); mainWindow.loadFile('index.html'); mainWindow.once('ready-to-show', () => { mainWindow.show(); }); } app.whenReady().then(() => { createWindow(); app.on('activate', function () { if (BrowserWindow.getAllWindows().length === 0) createWindow(); }); }); app.on('window-all-closed', function () { if (process.platform !== 'darwin') app.quit(); }); // IPC handlers ipcMain.on('window-controls', (event, action) => { if (!mainWindow) return; switch (action) { case 'close': app.quit(); break; case 'minimize': mainWindow.minimize(); break; } }); // Select installation directory ipcMain.handle('select-directory', async () => { const result = await dialog.showOpenDialog(mainWindow, { properties: ['openDirectory'] }); if (result.canceled) { return null; } else { return result.filePaths[0]; } });