fixes for macos

This commit is contained in:
Kyle Spearrin 2018-05-05 11:36:36 -04:00
parent 9d969929de
commit b8ae738621
2 changed files with 8 additions and 4 deletions

View File

@ -1046,5 +1046,9 @@
}, },
"exit": { "exit": {
"message": "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."
} }
} }

View File

@ -35,12 +35,12 @@ export class TrayMain {
async init(additionalMenuItems: MenuItemConstructorOptions[] = null) { async init(additionalMenuItems: MenuItemConstructorOptions[] = null) {
const menuItemOptions: MenuItemConstructorOptions[] = [{ const menuItemOptions: MenuItemConstructorOptions[] = [{
label: this.appName, label: this.i18nService.t('showHide'),
click: () => this.toggleWindow(), click: () => this.toggleWindow(),
}, },
{ type: 'separator' }, { type: 'separator' },
{ {
label: this.i18nService.t('exit'), label: process.platform === 'darwin' ? this.i18nService.t('close') : this.i18nService.t('exit'),
click: () => this.closeWindow(), click: () => this.closeWindow(),
}]; }];
@ -56,14 +56,14 @@ export class TrayMain {
this.windowMain.win.on('minimize', async (e: Event) => { this.windowMain.win.on('minimize', async (e: Event) => {
if (await this.storageService.get<boolean>(ElectronConstants.enableMinimizeToTrayKey)) { if (await this.storageService.get<boolean>(ElectronConstants.enableMinimizeToTrayKey)) {
e.preventDefault(); e.preventDefault();
await this.hideToTray(); this.hideToTray();
} }
}); });
this.windowMain.win.on('show', async (e: Event) => { this.windowMain.win.on('show', async (e: Event) => {
const enableTray = await this.storageService.get<boolean>(ElectronConstants.enableTrayKey); const enableTray = await this.storageService.get<boolean>(ElectronConstants.enableTrayKey);
if (!enableTray) { if (!enableTray) {
await this.removeTray(false); this.removeTray(false);
} }
}); });
} }