From f7bfe40b71adb618b99307504ce86aef862eb3ec Mon Sep 17 00:00:00 2001 From: Marcelo Dominguez Date: Mon, 16 Dec 2019 10:59:19 -0300 Subject: [PATCH] Add two globalShortcuts (#351) Cmd+Shift+L -> Search Vault Cmd+Shift+G -> Password Generator --- src/main.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 6e0c03643f..c68e341c34 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import { app } from 'electron'; +import { app, globalShortcut } from 'electron'; import * as path from 'path'; import { I18nService } from './services/i18n.service'; @@ -43,6 +43,26 @@ export class Main { appDataPath = path.join(process.env.SNAP_USER_DATA, 'appdata'); } + app.on('ready', () => { + globalShortcut.register('CommandOrControl+Shift+L', async () => { + if (this.windowMain.win === null) { + await this.windowMain.createWindow(); + } + + this.messagingService.send('focusSearch'); + this.windowMain.win.show(); + }); + + globalShortcut.register('CommandOrControl+Shift+G', async () => { + if (this.windowMain.win === null) { + await this.windowMain.createWindow(); + } + + this.messagingService.send('openPasswordGenerator'); + this.windowMain.win.show(); + }); + }); + if (appDataPath != null) { app.setPath('userData', appDataPath); }