Hide Hyperspace window on startup and show once page contents are loaded

Signed-off-by: Marquis Kurt <software@marquiskurt.net>
This commit is contained in:
Marquis Kurt 2019-10-05 17:10:29 -04:00
parent 4f48a77214
commit a487348053
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
1 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,6 @@
// desktop.js
// Electron script to run Hyperspace as an app
// © 2018 Hyperspace developers. Licensed under Apache 2.0.
// © 2018 Hyperspace developers. Licensed under NPL v1.
const { app, Menu, protocol, BrowserWindow, shell, systemPreferences } = require('electron');
const windowStateKeeper = require('electron-window-state');
@ -137,7 +137,10 @@ function createWindow() {
titleBarStyle: 'hiddenInset',
vibrancy: "sidebar",
transparent: darwin(),
backgroundColor: darwin()? "#80000000": "#FFF"
backgroundColor: darwin()? "#80000000": "#FFF",
// Hide the window until the contents load
show: false
}
);
@ -162,6 +165,11 @@ function createWindow() {
});
}
// Only show the window when ready
mainWindow.once('ready-to-show', () => {
mainWindow.show();
});
// Delete the window when closed
mainWindow.on('closed', () => {
mainWindow = null