Skip to content

Commit

Permalink
fix: windowmenu did not show the window list on macOS (electron#16387)
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak authored and akisctx committed Jan 22, 2019
1 parent ba62d64 commit 6ef516b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion atom/browser/ui/cocoa/atom_menu_controller.mm
Expand Up @@ -231,7 +231,9 @@ - (void)addItemToMenu:(NSMenu*)menu
[item setSubmenu:submenu];

// Set submenu's role.
if (role == base::ASCIIToUTF16("window") && [submenu numberOfItems])
if ((role == base::ASCIIToUTF16("window") ||
role == base::ASCIIToUTF16("windowmenu")) &&
[submenu numberOfItems])
[NSApp setWindowsMenu:submenu];
else if (role == base::ASCIIToUTF16("help"))
[NSApp setHelpMenu:submenu];
Expand Down
4 changes: 1 addition & 3 deletions lib/browser/api/menu-item-roles.js
Expand Up @@ -247,9 +247,7 @@ const roles = {
{ role: 'zoom' },
...(isMac ? [
{ type: 'separator' },
{ role: 'front' },
{ type: 'separator' },
{ role: 'window' }
{ role: 'front' }
] : [
{ role: 'close' }
])
Expand Down
2 changes: 0 additions & 2 deletions spec/api-menu-item-spec.js
Expand Up @@ -442,8 +442,6 @@ describe('MenuItems', () => {
if (process.platform === 'darwin') {
expect(item.submenu.items[2].type).to.equal('separator')
expect(item.submenu.items[3].role).to.equal('front')
expect(item.submenu.items[4].type).to.equal('separator')
expect(item.submenu.items[5].role).to.equal('window')
} else {
expect(item.submenu.items[2].role).to.equal('close')
}
Expand Down

0 comments on commit 6ef516b

Please sign in to comment.