1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

more tray icon options

This commit is contained in:
Kyle Spearrin
2018-05-05 00:29:02 -04:00
parent 4fd597fc05
commit 9d969929de
8 changed files with 127 additions and 37 deletions

View File

@@ -1,4 +1,8 @@
import { app, BrowserWindow } from 'electron';
import {
app,
BrowserWindow,
MenuItemConstructorOptions,
} from 'electron';
import * as path from 'path';
import { I18nService } from './services/i18n.service';
@@ -17,8 +21,6 @@ import { ElectronStorageService } from 'jslib/electron/services/electronStorage.
import { UpdaterMain } from 'jslib/electron/updater.main';
import { WindowMain } from 'jslib/electron/window.main';
import { DesktopConstants } from './desktopConstants';
export class Main {
logService: ElectronLogService;
i18nService: I18nService;
@@ -76,9 +78,7 @@ export class Main {
});
this.menuMain = new MenuMain(this);
this.powerMonitorMain = new PowerMonitorMain(this);
this.trayMain = new TrayMain(this.windowMain, 'Bitwarden', async () => {
return await this.storageService.get<boolean>(DesktopConstants.enableMinimizeToTrayKey);
});
this.trayMain = new TrayMain(this.windowMain, this.i18nService, this.storageService, 'Bitwarden');
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
this.messagingMain.onMessage(message);
@@ -95,7 +95,12 @@ export class Main {
this.messagingMain.init();
this.menuMain.init();
this.powerMonitorMain.init();
this.trayMain.init();
this.trayMain.init([{
label: this.i18nService.t('lockNow'),
enabled: false,
id: 'lockNow',
click: () => this.messagingService.send('lockVault'),
}]);
await this.updaterMain.init();
}, (e: any) => {
// tslint:disable-next-line