some fixes for mac menus

This commit is contained in:
SteVen Batten 2018-07-20 14:42:47 -07:00
parent dbc8505cd7
commit 3ce86b446b
4 changed files with 71 additions and 39 deletions

View file

@ -324,6 +324,14 @@ export class Menubar {
private setMacApplicationMenu(macApplicationMenu: Electron.Menu): void {
const about = new MenuItem({ label: nls.localize('mAbout', "About {0}", product.nameLong), role: 'about' });
const checkForUpdates = this.getUpdateMenuItems();
let preferences;
if (this.shouldDrawMenu('Preferences')) {
const preferencesMenu = new Menu();
this.setMenuById(preferencesMenu, 'Preferences');
preferences = new MenuItem({ label: this.mnemonicLabel(nls.localize({ key: 'miPreferences', comment: ['&& denotes a mnemonic'] }, "&&Preferences")), submenu: preferencesMenu });
}
const servicesMenu = new Menu();
const services = new MenuItem({ label: nls.localize('mServices', "Services"), role: 'services', submenu: servicesMenu });
const hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", product.nameLong), role: 'hide', accelerator: 'Command+H' });
@ -339,6 +347,14 @@ export class Menubar {
const actions = [about];
actions.push(...checkForUpdates);
if (preferences) {
actions.push(...[
__separator__(),
preferences
]);
}
actions.push(...[
__separator__(),
services,

View file

@ -652,6 +652,7 @@ function helpMenuRegistration() {
order: 2
});
if (!isMacintosh) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '5_tools',
command: {
@ -671,3 +672,4 @@ function helpMenuRegistration() {
order: 1
});
}
}

View file

@ -144,6 +144,7 @@ export class MenubarPart extends Part {
};
if (isMacintosh) {
this.topLevelMenus['Preferences'] = this._register(this.menuService.createMenu(MenuId.MenubarPreferencesMenu, this.contextKeyService));
this.topLevelMenus['Window'] = this._register(this.menuService.createMenu(MenuId.MenubarWindowMenu, this.contextKeyService));
}

View file

@ -163,6 +163,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
order: 2
});
if (!isMacintosh) {
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '2_open',
command: {
@ -180,6 +181,16 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
},
order: 2
});
} else {
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '2_open',
command: {
id: OpenFileFolderAction.ID,
title: nls.localize({ key: 'miOpen', comment: ['&& denotes a mnemonic'] }, "&&Open...")
},
order: 1
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '2_open',
@ -226,12 +237,14 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
order: 2
});
if (!isMacintosh) {
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
title: nls.localize({ key: 'miPreferences', comment: ['&& denotes a mnemonic'] }, "&&Preferences"),
submenu: MenuId.MenubarPreferencesMenu,
group: '5_autosave',
order: 2
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '6_close',