Disable background throttling
This commit is contained in:
parent
ea33f3d262
commit
27fd03f5f0
2 changed files with 5 additions and 17 deletions
|
|
@ -11,6 +11,10 @@ export class PreventDisplaySleepService {
|
||||||
|
|
||||||
constructor(private powerSaveBlocker: PowerSaveBlocker) {}
|
constructor(private powerSaveBlocker: PowerSaveBlocker) {}
|
||||||
|
|
||||||
|
isEnabled(): boolean {
|
||||||
|
return this.blockerId !== undefined;
|
||||||
|
}
|
||||||
|
|
||||||
setEnabled(isEnabled: boolean): void {
|
setEnabled(isEnabled: boolean): void {
|
||||||
log.info(
|
log.info(
|
||||||
`Prevent display sleep service: ${
|
`Prevent display sleep service: ${
|
||||||
|
|
|
||||||
18
app/main.ts
18
app/main.ts
|
|
@ -715,7 +715,6 @@ async function createWindow() {
|
||||||
: '../ts/windows/main/preload.js'
|
: '../ts/windows/main/preload.js'
|
||||||
),
|
),
|
||||||
spellcheck,
|
spellcheck,
|
||||||
backgroundThrottling: true,
|
|
||||||
},
|
},
|
||||||
icon: windowIcon,
|
icon: windowIcon,
|
||||||
...pick(windowConfig, ['autoHideMenuBar', 'x', 'y']),
|
...pick(windowConfig, ['autoHideMenuBar', 'x', 'y']),
|
||||||
|
|
@ -1109,21 +1108,6 @@ ipc.on('title-bar-double-click', () => {
|
||||||
|
|
||||||
ipc.on('set-is-call-active', (_event, isCallActive) => {
|
ipc.on('set-is-call-active', (_event, isCallActive) => {
|
||||||
preventDisplaySleepService.setEnabled(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) => {
|
ipc.on('convert-image', async (event, uuid, data) => {
|
||||||
|
|
@ -1168,7 +1152,7 @@ async function readyForUpdates() {
|
||||||
return (
|
return (
|
||||||
systemTrayService?.isVisible() === true &&
|
systemTrayService?.isVisible() === true &&
|
||||||
mainWindow?.isVisible() !== true &&
|
mainWindow?.isVisible() !== true &&
|
||||||
mainWindow?.webContents?.getBackgroundThrottling() !== false
|
!preventDisplaySleepService.isEnabled()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getMainWindow,
|
getMainWindow,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue