Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.

Commit 2185f32

Browse files
committed
Adds requested changes for start minimized
1 parent e4f6746 commit 2185f32

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

electron/main.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,10 @@ function createWindow () {
107107

108108
// Check if user has defined a custom User-Agent
109109
if ( config.get('user_agent').length > 0 ) mainWindow.webContents.setUserAgent( config.get('user_agent') );
110-
111-
if ( !config.get('start_minimized') && config.get('maximized') ) mainWindow.maximize();
112-
if (config.get('start_minimized')){
113-
if (config.get('window_display_behavior') == 'show_taskbar') {
114-
mainWindow.webContents.once('did-finish-load', function(e) {
115-
mainWindow.minimize();
116-
});
117-
}
118-
else {
119-
mainWindow.webContents.once('did-finish-load', function(e) {
120-
mainWindow.hide();
121-
});
122-
}
123-
}
110+
111+
// Wait for the mainWindow.loadURL(..) and the optional mainWindow.webContents.openDevTools()
112+
// to be finished before minimizing
113+
config.get('start_minimized') && mainWindow.webContents.once('did-finish-load', () => config.get('window_display_behavior') === 'show_trayIcon' ? mainWindow.hide() : mainWindow.minimize());
124114

125115
// Check if the window its outside of the view (ex: multi monitor setup)
126116
const { positionOnScreen } = require('./utils/positionOnScreen');

0 commit comments

Comments
 (0)