refs #2145 Divide quit application menu item to quit app in macOS
This commit is contained in:
parent
405a74203b
commit
1618cf0aa8
|
@ -334,10 +334,6 @@ async function createWindow() {
|
||||||
|
|
||||||
mainWindow.webContents.on('will-navigate', event => event.preventDefault())
|
mainWindow.webContents.on('will-navigate', event => event.preventDefault())
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
|
||||||
mainWindow = null
|
|
||||||
})
|
|
||||||
|
|
||||||
// Show tray icon only linux and windows.
|
// Show tray icon only linux and windows.
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
// Show tray icon
|
// Show tray icon
|
||||||
|
@ -358,11 +354,15 @@ async function createWindow() {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Minimize to tray
|
// Minimize to tray
|
||||||
mainWindow!.on('close', event => {
|
mainWindow.on('close', event => {
|
||||||
mainWindow!.hide()
|
mainWindow!.hide()
|
||||||
mainWindow!.setSkipTaskbar(true)
|
mainWindow!.setSkipTaskbar(true)
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
mainWindow.on('closed', () => {
|
||||||
|
mainWindow = null
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,6 +1163,25 @@ const ApplicationMenu = (accountsChange: Array<MenuItemConstructorOptions>, menu
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const applicationQuitMenu: Array<MenuItemConstructorOptions> =
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: i18n.t('main_menu.application.quit'),
|
||||||
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
|
role: 'quit'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
label: i18n.t('main_menu.application.quit'),
|
||||||
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
|
click: () => {
|
||||||
|
mainWindow!.destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
const template: Array<MenuItemConstructorOptions> = [
|
const template: Array<MenuItemConstructorOptions> = [
|
||||||
{
|
{
|
||||||
label: i18n.t('main_menu.application.name'),
|
label: i18n.t('main_menu.application.name'),
|
||||||
|
@ -1193,13 +1212,7 @@ const ApplicationMenu = (accountsChange: Array<MenuItemConstructorOptions>, menu
|
||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
{
|
...applicationQuitMenu
|
||||||
label: i18n.t('main_menu.application.quit'),
|
|
||||||
accelerator: 'CmdOrCtrl+Q',
|
|
||||||
click: () => {
|
|
||||||
mainWindow!.destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue