const { app, BrowserWindow, powerSaveBlocker } = require('electron'); const path = require('path'); function createWindow() { // Keep system and display from sleeping while the app is running powerSaveBlocker.start('prevent-app-suspension'); powerSaveBlocker.start('prevent-display-sleep'); const win = new BrowserWindow({ width: 320, height: 420, minWidth: 280, minHeight: 320, webPreferences: { preload: path.join(__dirname, 'preload.js'), contextIsolation: true, nodeIntegration: false, webviewTag: true, }, title: 'PTW Auto-Disconnect', show: false, }); win.once('ready-to-show', () => win.show()); win.loadFile('index.html'); } app.whenReady().then(createWindow); app.on('window-all-closed', () => app.quit());