show splash screen for smoother startup

This commit is contained in:
DJ2LS 2022-11-08 14:23:21 +01:00
parent 0fdcc40511
commit 232c10bf5f
2 changed files with 37 additions and 0 deletions

View file

@ -168,10 +168,26 @@ let data = null;
let logViewer = null;
var daemonProcess = null;
// create a splash screen
function createSplashScreen(){
splashScreen = new BrowserWindow({
height: 250,
width: 250,
transparent: true,
frame: false,
alwaysOnTop: true
});
splashScreen.loadFile('src/splash.html');
splashScreen.center();
}
function createWindow() {
win = new BrowserWindow({
width: config.screen_width,
height: config.screen_height,
show: false,
autoHideMenuBar: true,
icon: 'src/img/icon.png',
webPreferences: {
@ -285,8 +301,19 @@ function createWindow() {
}
app.whenReady().then(() => {
// show splash screen
createSplashScreen();
// create main window
createWindow();
// wait some time, then close splash screen and show main windows
setTimeout(function() {
splashScreen.close();
win.show();
}, 3000);
// start daemon by checking os
mainLog.info('Starting freedata-daemon binary');

10
gui/src/splash.html Normal file
View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<img src="./img/icon_cube_border.png" width="100%" height="100%">
</body>
</html>