option to min to tray icon
2
jslib
BIN
src/images/icon-highlight.png
Normal file
|
After Width: | Height: | Size: 292 B |
BIN
src/images/icon-highlight@2x.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
src/images/icon-template.png
Normal file
|
After Width: | Height: | Size: 292 B |
BIN
src/images/icon-template@2x.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
src/images/icon.ico
Normal file
|
After Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
@@ -540,5 +540,15 @@
|
||||
},
|
||||
"usernamePasswordNotConfigured": {
|
||||
"message": "Username/password are not configured."
|
||||
},
|
||||
"exit": {
|
||||
"message": "Exit"
|
||||
},
|
||||
"showHide": {
|
||||
"message": "Show / Hide",
|
||||
"description": "Text for a button that toggles the visibility of the window. Shows the window when it is hidden or hides the window if it is currently open."
|
||||
},
|
||||
"hideToTray": {
|
||||
"message": "Hide to Tray"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener';
|
||||
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
|
||||
import { ElectronMainMessagingService } from 'jslib/electron/services/electronMainMessaging.service';
|
||||
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
|
||||
import { TrayMain } from 'jslib/electron/tray.main';
|
||||
import { UpdaterMain } from 'jslib/electron/updater.main';
|
||||
import { WindowMain } from 'jslib/electron/window.main';
|
||||
|
||||
@@ -23,6 +24,7 @@ export class Main {
|
||||
messagingMain: MessagingMain;
|
||||
menuMain: MenuMain;
|
||||
updaterMain: UpdaterMain;
|
||||
trayMain: TrayMain;
|
||||
|
||||
constructor() {
|
||||
// Set paths for portable builds
|
||||
@@ -57,7 +59,8 @@ export class Main {
|
||||
}, null, () => {
|
||||
this.messagingService.send('doneCheckingForUpdate');
|
||||
});
|
||||
this.messagingMain = new MessagingMain(this.windowMain, this.menuMain, this.updaterMain);
|
||||
this.trayMain = new TrayMain(this.windowMain, this.i18nService, this.storageService,);
|
||||
this.messagingMain = new MessagingMain(this.windowMain, this.menuMain, this.updaterMain, this.trayMain);
|
||||
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
|
||||
this.messagingMain.onMessage(message);
|
||||
});
|
||||
@@ -72,6 +75,7 @@ export class Main {
|
||||
this.menuMain.init();
|
||||
this.messagingMain.init();
|
||||
await this.updaterMain.init();
|
||||
await this.trayMain.init(this.i18nService.t('bitwardenDirectoryConnector'));
|
||||
}, (e: any) => {
|
||||
// tslint:disable-next-line
|
||||
console.error(e);
|
||||
|
||||
@@ -48,6 +48,12 @@ export class MenuMain extends BaseMenu {
|
||||
template[template.length - 1].submenu = this.macWindowSubmenuOptions;
|
||||
}
|
||||
|
||||
(template[template.length - 1].submenu as MenuItemConstructorOptions[]).splice(1, 0, {
|
||||
label: this.main.i18nService.t('hideToTray'),
|
||||
click: () => this.main.messagingService.send('hideToTray'),
|
||||
accelerator: 'CmdOrCtrl+Shift+M',
|
||||
});
|
||||
|
||||
this.menu = Menu.buildFromTemplate(template);
|
||||
Menu.setApplicationMenu(this.menu);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
ipcMain,
|
||||
} from 'electron';
|
||||
|
||||
import { TrayMain } from 'jslib/electron/tray.main';
|
||||
import { UpdaterMain } from 'jslib/electron/updater.main';
|
||||
import { WindowMain } from 'jslib/electron/window.main';
|
||||
|
||||
@@ -14,7 +15,7 @@ export class MessagingMain {
|
||||
private syncTimeout: NodeJS.Timer;
|
||||
|
||||
constructor(private windowMain: WindowMain, private menuMain: MenuMain,
|
||||
private updaterMain: UpdaterMain) { }
|
||||
private updaterMain: UpdaterMain, private trayMain: TrayMain) { }
|
||||
|
||||
init() {
|
||||
ipcMain.on('messagingService', async (event: any, message: any) => this.onMessage(message));
|
||||
@@ -36,6 +37,9 @@ export class MessagingMain {
|
||||
global.clearTimeout(this.syncTimeout);
|
||||
}
|
||||
break;
|
||||
case 'hideToTray':
|
||||
this.trayMain.hideToTray();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||