From b1cb245f85700219142e3b9c10c1b4dc06da4395 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Fri, 2 Sep 2016 08:41:07 +0200 Subject: [PATCH 1/2] Disables keep in task bar default setting for linux because this is uncommon for apps on linux per default --- electron/global_settings.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/electron/global_settings.js b/electron/global_settings.js index 94c04c18..b4f0dcf2 100644 --- a/electron/global_settings.js +++ b/electron/global_settings.js @@ -26,6 +26,11 @@ var globalSettings = { } }; +if (process.platform === 'linux') { + // default setting for linux: exit app on close + globalSettings.settings.keep_in_taskbar_on_close = 0; +} + try { //test to see if settings exist fs.openSync(settingsPathname, 'r+'); //throws error if file doesn't exist From ec5cafdeb958164bba49d1b91b7691e0beca0995 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Fri, 2 Sep 2016 08:42:08 +0200 Subject: [PATCH 2/2] Updates main window close handling: mac os and windows unchanged; linux: when keep in task bar is enabled hide the main window, else exit app --- electron/main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/electron/main.js b/electron/main.js index e2a28c2a..8d024750 100644 --- a/electron/main.js +++ b/electron/main.js @@ -155,6 +155,19 @@ function createWindow () { if ( !isQuitting ) { e.preventDefault(); + switch (process.platform) { + case 'darwin': + app.hide(); + break; + case 'linux': + parseInt(globalSettings.get('keep_in_taskbar_on_close')) ? mainWindow.hide() : app.quit(); + break; + case 'win32': + default: + parseInt(globalSettings.get('keep_in_taskbar_on_close')) ? mainWindow.minimize() : mainWindow.hide(); + break; + } + if (process.platform === 'darwin') { app.hide(); } else {