Skip to content

Commit

Permalink
Fix shortcuts on macOS
Browse files Browse the repository at this point in the history
The regular windows shortcuts (eg. minimise, hide) don't work unless
they have menu entries, so add them along with the standard set of
expected menu items for mac (although I've omitted 'about' since it
opens a window so is a slightly more visible change).

Also Electron has a role for 'quit' so use this instead of providing
our own.
  • Loading branch information
dbkr authored and saghul committed Apr 30, 2020
1 parent e860605 commit 238e28a
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@ function setApplicationMenu() {
if (process.platform === 'darwin') {
const template = [ {
label: app.name,
submenu: [ {
label: 'Quit',
accelerator: 'Command+Q',
click() {
app.quit();
}
} ]
submenu: [
{
role: 'services',
submenu: []
},
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
]
}, {
label: 'Edit',
submenu: [ {
Expand Down Expand Up @@ -92,7 +97,13 @@ function setApplicationMenu() {
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
selector: 'selectAll:'
}
} ]
}, {
label: '&Window',
role: 'window',
submenu: [
{ role: 'minimize' },
{ role: 'close' }
]
} ];

Expand Down

0 comments on commit 238e28a

Please sign in to comment.