Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ts/node/power_saver_inhibitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ function preventAppSuspensionElectron() {
// if the power save blocker is already running, do not attempt to lock it again.
return;
}
electronBlockerId = powerSaveBlocker.start('prevent-app-suspension');
// On Linux, 'prevent-app-suspension' maps to systemd-inhibit --what=idle which blocks
// the entire idle pipeline (screensaver, lock screen, DPMS). Use 'prevent-display-sleep'
// instead, which maps to --what=sleep and only prevents suspend.
// On macOS/Windows, 'prevent-app-suspension' is correct.
const blockerType =
process.platform === 'linux' ? 'prevent-display-sleep' : 'prevent-app-suspension';
electronBlockerId = powerSaveBlocker.start(blockerType);
}

powerMonitor.on('resume', () => {
Expand All @@ -31,7 +37,7 @@ export function startAppSuspensionBlocker(): void {
const proc = spawn(
'systemd-inhibit',
[
'--what=idle',
'--what=sleep',
`--who=${packageJson.productName}`,
`--why=Keeping ${packageJson.name} running`,
'--mode=block',
Expand Down