diff --git a/app/PreventDisplaySleepService.ts b/app/PreventDisplaySleepService.ts index ff5905f3a262..9996d109f06f 100644 --- a/app/PreventDisplaySleepService.ts +++ b/app/PreventDisplaySleepService.ts @@ -11,6 +11,10 @@ export class PreventDisplaySleepService { constructor(private powerSaveBlocker: PowerSaveBlocker) {} + isEnabled(): boolean { + return this.blockerId !== undefined; + } + setEnabled(isEnabled: boolean): void { log.info( `Prevent display sleep service: ${ diff --git a/app/main.ts b/app/main.ts index 7f2dedc4bee7..b58411c7f661 100644 --- a/app/main.ts +++ b/app/main.ts @@ -715,7 +715,6 @@ async function createWindow() { : '../ts/windows/main/preload.js' ), spellcheck, - backgroundThrottling: true, }, icon: windowIcon, ...pick(windowConfig, ['autoHideMenuBar', 'x', 'y']), @@ -1109,21 +1108,6 @@ ipc.on('title-bar-double-click', () => { ipc.on('set-is-call-active', (_event, isCallActive) => { preventDisplaySleepService.setEnabled(isCallActive); - - if (!mainWindow) { - return; - } - - let backgroundThrottling: boolean; - if (isCallActive) { - log.info('Background throttling disabled because a call is active'); - backgroundThrottling = false; - } else { - log.info('Background throttling enabled because no call is active'); - backgroundThrottling = true; - } - - mainWindow.webContents.setBackgroundThrottling(backgroundThrottling); }); ipc.on('convert-image', async (event, uuid, data) => { @@ -1168,7 +1152,7 @@ async function readyForUpdates() { return ( systemTrayService?.isVisible() === true && mainWindow?.isVisible() !== true && - mainWindow?.webContents?.getBackgroundThrottling() !== false + !preventDisplaySleepService.isEnabled() ); }, getMainWindow,