[MM-26832] don't show the window until it is ready (#1345)
* [MM-26832] don't show the window until it is ready * [MM-26832] allow the app to still paint itself while initially hidden * fix tests, ensure it appears if not using silent mode
This commit is contained in:
@@ -44,7 +44,7 @@ function createMainWindow(config, options) {
|
|||||||
windowOptions = {width: defaultWindowWidth, height: defaultWindowHeight};
|
windowOptions = {width: defaultWindowWidth, height: defaultWindowHeight};
|
||||||
}
|
}
|
||||||
|
|
||||||
const {hideOnStartup, trayIconShown} = options;
|
const {hideOnStartup} = options;
|
||||||
const {maximized: windowIsMaximized} = windowOptions;
|
const {maximized: windowIsMaximized} = windowOptions;
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
@@ -53,7 +53,8 @@ function createMainWindow(config, options) {
|
|||||||
Object.assign(windowOptions, {
|
Object.assign(windowOptions, {
|
||||||
title: app.name,
|
title: app.name,
|
||||||
fullscreenable: true,
|
fullscreenable: true,
|
||||||
show: hideOnStartup || false,
|
show: false, // don't start the window until it is ready and only if it isn't hidden
|
||||||
|
paintWhenInitiallyHidden: true, // we want it to start painting to get info from the webapp
|
||||||
minWidth: minimumWindowWidth,
|
minWidth: minimumWindowWidth,
|
||||||
minHeight: minimumWindowHeight,
|
minHeight: minimumWindowHeight,
|
||||||
frame: !isFramelessWindow(),
|
frame: !isFramelessWindow(),
|
||||||
@@ -75,15 +76,6 @@ function createMainWindow(config, options) {
|
|||||||
const indexURL = global.isDev ? 'http://localhost:8080/browser/index.html' : `file://${app.getAppPath()}/browser/index.html`;
|
const indexURL = global.isDev ? 'http://localhost:8080/browser/index.html' : `file://${app.getAppPath()}/browser/index.html`;
|
||||||
mainWindow.loadURL(indexURL);
|
mainWindow.loadURL(indexURL);
|
||||||
|
|
||||||
// handle hiding the app when launched by auto-start
|
|
||||||
if (hideOnStartup) {
|
|
||||||
if (trayIconShown && process.platform !== 'darwin') {
|
|
||||||
mainWindow.hide();
|
|
||||||
} else {
|
|
||||||
mainWindow.minimize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
mainWindow.webContents.zoomLevel = 0;
|
mainWindow.webContents.zoomLevel = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user