From 394e86f765f15d728eecdfbb1e63a84d60d7f9f9 Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Wed, 21 Sep 2016 16:48:16 +0900 Subject: [PATCH] fix quit bug on Ubuntu --- lib/main-window.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/main-window.js b/lib/main-window.js index b9620288..a4333418 100644 --- a/lib/main-window.js +++ b/lib/main-window.js @@ -32,22 +32,24 @@ mainWindow.webContents.sendInputEvent({ keyCode: '\u0008' }) -mainWindow.on('close', function (e) { - if (process.platform === 'linux' && process.env.DESKTOP_SESSION !== 'cinnamon') { +if (process.platform !== 'linux' || process.env.DESKTOP_SESSION === 'cinnamon') { + mainWindow.on('close', function (e) { + mainWindow.hide() + e.preventDefault() + }) + + app.on('before-quit', function (e) { + mainWindow.removeAllListeners() + }) +} else { + app.on('window-all-closed', function () { app.quit() - return true - } - mainWindow.hide() - e.preventDefault() -}) + }) +} app.on('activate', function () { if (mainWindow == null) return null mainWindow.show() }) -app.on('before-quit', function (e) { - mainWindow.removeAllListeners() -}) - module.exports = mainWindow