dont use powerMonitor on snaps

This commit is contained in:
Kyle Spearrin 2018-07-26 16:50:05 -04:00
parent 6e53e9b441
commit fea8ab5921
1 changed files with 12 additions and 7 deletions

View File

@ -2,6 +2,8 @@ import { powerMonitor } from 'electron';
import { ConstantsService } from 'jslib/services/constants.service'; import { ConstantsService } from 'jslib/services/constants.service';
import { isSnapStore } from 'jslib/electron/utils';
import { Main } from '../main'; import { Main } from '../main';
// tslint:disable-next-line // tslint:disable-next-line
@ -15,6 +17,8 @@ export class PowerMonitorMain {
constructor(private main: Main) { } constructor(private main: Main) { }
init() { init() {
// ref: https://github.com/electron/electron/issues/13767
if (!isSnapStore()) {
// System sleep // System sleep
powerMonitor.on('suspend', async () => { powerMonitor.on('suspend', async () => {
const lockOption = await this.getLockOption(); const lockOption = await this.getLockOption();
@ -22,6 +26,7 @@ export class PowerMonitorMain {
this.main.messagingService.send('lockVault'); this.main.messagingService.send('lockVault');
} }
}); });
}
// System idle // System idle
global.setInterval(async () => { global.setInterval(async () => {