1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-05 23:53:21 +00:00

option to min to tray icon

This commit is contained in:
Kyle Spearrin
2018-05-08 12:05:20 -04:00
parent 6c05a4ec25
commit eef9f151ef
14 changed files with 27 additions and 3 deletions

2
jslib

Submodule jslib updated: 3270d8bd0e...9de9c1655c

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

BIN
src/images/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -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"
}
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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;
}