Skip to content

Commit

Permalink
Merge pull request #449 from h3poteto/fix/hidding-menu
Browse files Browse the repository at this point in the history
Fix disable some menu item when window is hidden in mac
  • Loading branch information
h3poteto authored Jul 22, 2018
2 parents dcc3850 + 2b9b79f commit 9d28207
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,20 @@ async function createWindow () {
},
{
type: 'separator'
}
].concat(accountsChange)
.concat([
{
type: 'separator'
},
{
label: 'Jump to',
accelerator: 'CmdOrCtrl+K',
click: () => {
mainWindow.webContents.send('CmdOrCtrl+K')
}
},
{
label: 'Jump to',
accelerator: 'CmdOrCtrl+K',
enabled: true,
click: () => {
mainWindow.webContents.send('CmdOrCtrl+K')
}
])
},
{
type: 'separator'
},
...accountsChange
]
}
]

Expand Down Expand Up @@ -308,6 +308,15 @@ app.on('window-all-closed', () => {
// In macOS, close button does not shutdown application. It is hide application window.
if (process.platform !== 'darwin') {
app.quit()
} else {
// In MacOS, we should change disable some menu items.
const menu = Menu.getApplicationMenu()
// Preferences
menu.items[0].submenu.items[2].enabled = false
// New Toot
menu.items[1].submenu.items[0].enabled = false
// Jump to
menu.items[4].submenu.items[3].enabled = false
}
})

Expand Down

0 comments on commit 9d28207

Please sign in to comment.