From 232c10bf5fe84aa26539550ef85a450a6566fbf3 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Tue, 8 Nov 2022 14:23:21 +0100 Subject: [PATCH] show splash screen for smoother startup --- gui/main.js | 27 +++++++++++++++++++++++++++ gui/src/splash.html | 10 ++++++++++ 2 files changed, 37 insertions(+) create mode 100644 gui/src/splash.html diff --git a/gui/main.js b/gui/main.js index 47e8f687..0b6c012d 100644 --- a/gui/main.js +++ b/gui/main.js @@ -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'); diff --git a/gui/src/splash.html b/gui/src/splash.html new file mode 100644 index 00000000..07bbe511 --- /dev/null +++ b/gui/src/splash.html @@ -0,0 +1,10 @@ + + + + + + + + + +