From f8b6c25961bbbd0e44c25c1bcce72a12977323cd Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Mon, 12 Sep 2016 20:43:13 +0200 Subject: [PATCH 1/2] Disables "keep in taskbar on close" for linux per default --- electron/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/electron/main.js b/electron/main.js index f07ad6b4..3ce3b29b 100644 --- a/electron/main.js +++ b/electron/main.js @@ -24,7 +24,7 @@ const config = new Config({ ,hide_menu_bar: false ,skip_taskbar: true ,auto_launch: !isDev - ,keep_in_taskbar_on_close: true + ,keep_in_taskbar_on_close: getDefaultValueForkeep_in_taskbar_on_close() ,start_minimized: false ,systemtray_indicator: true ,master_password: false @@ -40,6 +40,15 @@ const config = new Config({ } }); +/** + * Returns the default value for "keep_in_taskbar_on_close". + * On all platforms except linux: true + * On linux: false (because it's uncommon for apps on linux to stay in the taskbar on close) + */ +function getDefaultValueForkeep_in_taskbar_on_close() { + return process.platform !== 'linux'; +} + // Configure AutoLaunch const appLauncher = new AutoLaunch({ name: 'Rambox' From 8e3df94f205ac628976822b757d96069bb079b54 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Mon, 12 Sep 2016 20:57:25 +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 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/electron/main.js b/electron/main.js index 3ce3b29b..fd223c40 100644 --- a/electron/main.js +++ b/electron/main.js @@ -201,10 +201,17 @@ function createWindow () { if ( !isQuitting ) { e.preventDefault(); - if (process.platform === 'darwin') { - app.hide(); - } else { - config.get('keep_in_taskbar_on_close') ? mainWindow.minimize() : mainWindow.hide(); + switch (process.platform) { + case 'darwin': + app.hide(); + break; + case 'linux': + config.get('keep_in_taskbar_on_close') ? mainWindow.hide() : app.quit(); + break; + case 'win32': + default: + config.get('keep_in_taskbar_on_close') ? mainWindow.minimize() : mainWindow.hide(); + break; } } });