修复启用托盘后无法退出程序的问题

This commit is contained in:
lyswhut
2020-04-03 21:30:48 +08:00
parent 2e84788d53
commit be84bd27d3
3 changed files with 16 additions and 4 deletions
+8 -1
View File
@@ -12,7 +12,14 @@ if (isMac) {
{ label: '显示其他', role: 'hideothers' },
{ label: '显示全部', role: 'unhide' },
{ type: 'separator' },
{ label: '退出', accelerator: 'Command+Q', click: () => app.quit() },
{
label: '退出',
accelerator: 'Command+Q',
click() {
global.isQuitting = true
app.quit()
},
},
],
},
{
+5 -2
View File
@@ -1,4 +1,4 @@
const { Tray, Menu } = require('electron')
const { app, Tray, Menu } = require('electron')
const { isMac, isWin } = require('../../common/utils')
const { tray: TRAY_EVENT_NAME } = require('../events/_name')
const path = require('path')
@@ -21,7 +21,10 @@ function createTray() {
const contextMenu = Menu.buildFromTemplate([
{
label: '退出',
role: 'quit',
click() {
global.isQuitting = true
app.quit()
},
},
])
tray.setToolTip('洛雪音乐助手')