From 2185f32dd87e0e83a509603b1b8882cbdc3df502 Mon Sep 17 00:00:00 2001 From: andreas Date: Fri, 20 Mar 2020 15:53:06 +0100 Subject: [PATCH] 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');