fix: 🐛 MacOS reduced to the tray to evoke failure

This commit is contained in:
viarotel 2023-11-03 16:46:29 +08:00
parent bd36dd3336
commit d7bf83b488

View File

@ -94,25 +94,6 @@ function createWindow() {
events(mainWindow)
}
app.on('window-all-closed', () => {
app.quit()
mainWindow = null
})
// 仅 macOS 有这个事件
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
if (!app.dock.isVisible()) {
app.dock.show()
}
app.show()
app.focus()
})
app.whenReady().then(() => {
electronApp.setAppUserModelId('com.viarotel.escrcpy')
@ -121,4 +102,20 @@ app.whenReady().then(() => {
})
createWindow()
// macOS 中应用被激活
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
return
}
app.dock.show()
mainWindow.show()
})
})
app.on('window-all-closed', () => {
app.quit()
mainWindow = null
})