lock on system locked
This commit is contained in:
parent
cd7b9bd449
commit
5d7f73b263
|
@ -60,10 +60,16 @@ export class SettingsComponent implements OnInit {
|
|||
{ name: i18nService.t('fourHours'), value: 240 },
|
||||
{ name: i18nService.t('onIdle'), value: -4 },
|
||||
{ name: i18nService.t('onSleep'), value: -3 },
|
||||
// { name: i18nService.t('onLocked'), value: -2 },
|
||||
];
|
||||
|
||||
if (this.platformUtilsService.getDevice() !== DeviceType.LinuxDesktop) {
|
||||
this.lockOptions.push({ name: i18nService.t('onLocked'), value: -2 });
|
||||
}
|
||||
|
||||
this.lockOptions = this.lockOptions.concat([
|
||||
{ name: i18nService.t('onRestart'), value: -1 },
|
||||
{ name: i18nService.t('never'), value: null },
|
||||
];
|
||||
]);
|
||||
|
||||
const localeOptions: any[] = [];
|
||||
i18nService.supportedTranslationLocales.forEach((locale) => {
|
||||
|
|
|
@ -28,6 +28,16 @@ export class PowerMonitorMain {
|
|||
});
|
||||
}
|
||||
|
||||
if (process.platform !== 'linux') {
|
||||
// System locked
|
||||
powerMonitor.on('lock-screen', async () => {
|
||||
const lockOption = await this.getLockOption();
|
||||
if (lockOption === -2) {
|
||||
this.main.messagingService.send('lockVault');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// System idle
|
||||
global.setInterval(async () => {
|
||||
const idleSeconds: number = desktopIdle.getIdleTime();
|
||||
|
@ -45,8 +55,6 @@ export class PowerMonitorMain {
|
|||
|
||||
this.idle = idle;
|
||||
}, IdleCheckInterval);
|
||||
|
||||
// TODO: System locked
|
||||
}
|
||||
|
||||
private getLockOption(): Promise<number> {
|
||||
|
|
Loading…
Reference in New Issue