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

Commit

Permalink
Adds requested changes for start minimized
Browse files Browse the repository at this point in the history
  • Loading branch information
andia89 committed Mar 20, 2020
1 parent e4f6746 commit 2185f32
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 2185f32

Please sign in to comment.