Skip to content

Commit 394e86f

Browse files
committed
fix quit bug on Ubuntu
1 parent 6bb9366 commit 394e86f

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

lib/main-window.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,24 @@ mainWindow.webContents.sendInputEvent({
3232
keyCode: '\u0008'
3333
})
3434

35-
mainWindow.on('close', function (e) {
36-
if (process.platform === 'linux' && process.env.DESKTOP_SESSION !== 'cinnamon') {
35+
if (process.platform !== 'linux' || process.env.DESKTOP_SESSION === 'cinnamon') {
36+
mainWindow.on('close', function (e) {
37+
mainWindow.hide()
38+
e.preventDefault()
39+
})
40+
41+
app.on('before-quit', function (e) {
42+
mainWindow.removeAllListeners()
43+
})
44+
} else {
45+
app.on('window-all-closed', function () {
3746
app.quit()
38-
return true
39-
}
40-
mainWindow.hide()
41-
e.preventDefault()
42-
})
47+
})
48+
}
4349

4450
app.on('activate', function () {
4551
if (mainWindow == null) return null
4652
mainWindow.show()
4753
})
4854

49-
app.on('before-quit', function (e) {
50-
mainWindow.removeAllListeners()
51-
})
52-
5355
module.exports = mainWindow

0 commit comments

Comments
 (0)