From e4f6746b280ae8843b0655c01516c6b2e14911fd Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 16 Mar 2020 14:47:05 +0100 Subject: [PATCH 1/2] Fixes start miniized --- electron/main.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/electron/main.js b/electron/main.js index 777f58342..cc1b1f6a7 100644 --- a/electron/main.js +++ b/electron/main.js @@ -109,12 +109,17 @@ function createWindow () { if ( config.get('user_agent').length > 0 ) mainWindow.webContents.setUserAgent( config.get('user_agent') ); if ( !config.get('start_minimized') && config.get('maximized') ) mainWindow.maximize(); - if ( config.get('window_display_behavior') !== 'show_trayIcon' && config.get('start_minimized') ) { - // Wait for the mainWindow.loadURL(..) and the optional mainWindow.webContents.openDevTools() - // to be finished before minimizing - mainWindow.webContents.once('did-finish-load', function(e) { - mainWindow.minimize(); - }); + if (config.get('start_minimized')){ + if (config.get('window_display_behavior') == 'show_taskbar') { + mainWindow.webContents.once('did-finish-load', function(e) { + mainWindow.minimize(); + }); + } + else { + mainWindow.webContents.once('did-finish-load', function(e) { + mainWindow.hide(); + }); + } } // Check if the window its outside of the view (ex: multi monitor setup) From 2185f32dd87e0e83a509603b1b8882cbdc3df502 Mon Sep 17 00:00:00 2001 From: andreas Date: Fri, 20 Mar 2020 15:53:06 +0100 Subject: [PATCH 2/2] Adds requested changes for start minimized --- electron/main.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/electron/main.js b/electron/main.js index cc1b1f6a7..74ad0c5d1 100644 --- a/electron/main.js +++ b/electron/main.js @@ -107,20 +107,10 @@ function createWindow () { // Check if user has defined a custom User-Agent if ( config.get('user_agent').length > 0 ) mainWindow.webContents.setUserAgent( config.get('user_agent') ); - - if ( !config.get('start_minimized') && config.get('maximized') ) mainWindow.maximize(); - if (config.get('start_minimized')){ - if (config.get('window_display_behavior') == 'show_taskbar') { - mainWindow.webContents.once('did-finish-load', function(e) { - mainWindow.minimize(); - }); - } - else { - mainWindow.webContents.once('did-finish-load', function(e) { - mainWindow.hide(); - }); - } - } + + // Wait for the mainWindow.loadURL(..) and the optional mainWindow.webContents.openDevTools() + // to be finished before minimizing + config.get('start_minimized') && mainWindow.webContents.once('did-finish-load', () => config.get('window_display_behavior') === 'show_trayIcon' ? mainWindow.hide() : mainWindow.minimize()); // Check if the window its outside of the view (ex: multi monitor setup) const { positionOnScreen } = require('./utils/positionOnScreen');