Skip to content

Commit

Permalink
refactor: adapt menu for ios users
Browse files Browse the repository at this point in the history
refs #134
  • Loading branch information
Kim authored and juancarlosfarah committed Aug 5, 2019
1 parent 7edc1a6 commit 02b40b5
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,26 @@ const createWindow = () => {
// };

const generateMenu = () => {
const isMac = process.platform === 'darwin';
const template = [
...(isMac
? [
{
label: app.getName(),
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' },
],
},
]
: []),
{
label: 'File',
submenu: [
Expand Down Expand Up @@ -181,10 +200,7 @@ const generateMenu = () => {
});
},
},
{
label: 'Quit',
role: 'quit',
},
isMac ? { role: 'close' } : { role: 'quit' },
],
},
{ type: 'separator' },
Expand All @@ -197,9 +213,7 @@ const generateMenu = () => {
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'delete' },
{ role: 'selectall' },
{ role: 'selectAll' },
],
},
{
Expand All @@ -210,7 +224,6 @@ const generateMenu = () => {
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
Expand All @@ -219,7 +232,18 @@ const generateMenu = () => {
},
{
role: 'window',
submenu: [{ role: 'minimize' }, { role: 'close' }],
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
...(isMac
? [
{ type: 'separator' },
{ role: 'front' },
{ type: 'separator' },
{ role: 'window' },
]
: [{ role: 'close' }]),
],
},
{
role: 'help',
Expand Down

0 comments on commit 02b40b5

Please sign in to comment.