Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
dont use powerMonitor on snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jul 26, 2018
1 parent 6e53e9b commit fea8ab5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/powerMonitor.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 () => {
Expand Down

0 comments on commit fea8ab5

Please sign in to comment.