From fea8ab5921cc7b7f8a6a0f8d37f7ae13b64fede3 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 26 Jul 2018 16:50:05 -0400 Subject: [PATCH] dont use powerMonitor on snaps --- src/main/powerMonitor.main.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/powerMonitor.main.ts b/src/main/powerMonitor.main.ts index 6e9d4f4bf3..848b2eb895 100644 --- a/src/main/powerMonitor.main.ts +++ b/src/main/powerMonitor.main.ts @@ -2,6 +2,8 @@ import { powerMonitor } from 'electron'; import { ConstantsService } from 'jslib/services/constants.service'; +import { isSnapStore } from 'jslib/electron/utils'; + import { Main } from '../main'; // tslint:disable-next-line @@ -15,13 +17,16 @@ export class PowerMonitorMain { constructor(private main: Main) { } init() { - // System sleep - powerMonitor.on('suspend', async () => { - const lockOption = await this.getLockOption(); - if (lockOption === -3) { - this.main.messagingService.send('lockVault'); - } - }); + // ref: https://github.com/electron/electron/issues/13767 + if (!isSnapStore()) { + // System sleep + powerMonitor.on('suspend', async () => { + const lockOption = await this.getLockOption(); + if (lockOption === -3) { + this.main.messagingService.send('lockVault'); + } + }); + } // System idle global.setInterval(async () => {