|
1 | | -const {app, BrowserWindow, Tray, Notification, Menu, globalShortcut } = require('electron/main'); |
| 1 | +const {app, BrowserWindow, Tray, Notification, Menu, globalShortcut, powerSaveBlocker } = require('electron/main'); |
2 | 2 | const path = require('node:path'); |
3 | 3 | const {ipcMain} = require('electron') |
4 | 4 | const http = require('http'); |
5 | 5 | const xml = require("xml2js"); |
6 | 6 | const net = require('net'); |
7 | 7 |
|
| 8 | +let powerSaveBlockerId; |
8 | 9 | let tray; |
9 | 10 | let s_mainWindow; |
10 | 11 | let msgbacklog=[]; |
@@ -44,6 +45,7 @@ function createWindow () { |
44 | 45 | autoHideMenuBar: app.isPackaged, |
45 | 46 | webPreferences: { |
46 | 47 | contextIsolation: false, |
| 48 | + backgroundThrottling: false, |
47 | 49 | nodeIntegration: true, |
48 | 50 | devTools: !app.isPackaged, |
49 | 51 | enableRemoteModule: true, |
@@ -178,7 +180,12 @@ app.on('before-quit', () => { |
178 | 180 | } |
179 | 181 | }); |
180 | 182 |
|
| 183 | +app.on('will-quit', () => { |
| 184 | + powerSaveBlocker.stop(powerSaveBlockerId); |
| 185 | +}); |
| 186 | + |
181 | 187 | app.whenReady().then(() => { |
| 188 | + powerSaveBlockerId = powerSaveBlocker.start('prevent-app-suspension'); |
182 | 189 | s_mainWindow=createWindow(); |
183 | 190 | createAdvancedWindow(s_mainWindow); |
184 | 191 | globalShortcut.register('Control+Shift+I', () => { return false; }); |
|
0 commit comments