main: init app menu on ready event to fix macOs menus & shortcuts -> 0.24.2
This commit is contained in:
parent
ce247b4098
commit
aeef06749d
5 changed files with 19 additions and 18 deletions
|
|
@ -13,12 +13,6 @@ if (settings.read('noGpu') || (!settings.cli && settings.read('argv')['disable-
|
|||
app.disableHardwareAcceleration()
|
||||
}
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
if (process.platform != 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
var template = [{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
|
|
@ -60,8 +54,6 @@ if (process.platform === 'darwin') {
|
|||
}
|
||||
]
|
||||
})
|
||||
|
||||
// Add Window menu (OS X)
|
||||
template.push(
|
||||
{
|
||||
label: 'Window',
|
||||
|
|
@ -101,9 +93,19 @@ if (process.platform === 'darwin') {
|
|||
)
|
||||
}
|
||||
|
||||
app.on('before-quit',()=>{
|
||||
process.exit()
|
||||
})
|
||||
|
||||
var menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
app.on('ready',()=>{
|
||||
var menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
})
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = app
|
||||
|
|
|
|||
|
|
@ -37,16 +37,10 @@ var start = function(readyApp) {
|
|||
address += settings.read('urlOptions')
|
||||
if (app.isReady()) {
|
||||
var win = require('./electron-window')({address:address, shortcuts:true})
|
||||
app.on('before-quit',()=>{
|
||||
process.exit()
|
||||
})
|
||||
return win
|
||||
} else {
|
||||
app.on('ready',function(){
|
||||
var win = require('./electron-window')({address:address, shortcuts:true})
|
||||
app.on('before-quit',()=>{
|
||||
process.exit()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue