Splash screen
Some checks failed
MacOS Build / build (20) (push) Waiting to run
Ubuntu 22.04 - AppImage Build / build (20) (push) Waiting to run
Ubuntu 22.04 - x64 DEB Build / build (20) (push) Waiting to run
Ubuntu 24.04 - x64 DEB Build / build (20) (push) Waiting to run
Windows Build / build (20) (push) Has been cancelled

This commit is contained in:
everoddandeven 2024-10-29 18:34:25 +01:00
parent 9ff618809e
commit 89a2b2229f
2 changed files with 70 additions and 2 deletions

View file

@ -130,7 +130,7 @@ function createWindow(): BrowserWindow {
devTools: !app.isPackaged, devTools: !app.isPackaged,
sandbox: false sandbox: false
}, },
show: !minimized, show: false,
autoHideMenuBar: true, autoHideMenuBar: true,
icon: wdwIcon icon: wdwIcon
}); });
@ -193,6 +193,42 @@ function createWindow(): BrowserWindow {
return win; return win;
} }
const createSplashWindow = async (): Promise<BrowserWindow> => {
const window = new BrowserWindow({
width: 480,
height: 480,
transparent: true,
frame: false,
alwaysOnTop: true,
show: false,
icon: wdwIcon,
minimizable: false,
maximizable: false,
fullscreen: false
});
// Path when running electron executable
let pathIndex = './splash.html';
if (fs.existsSync(path.join(dirname, '../dist/splash.html'))) {
// Path when running electron in local folder
pathIndex = '../dist/splash.html';
}
const url = new URL(path.join('file:', dirname, pathIndex));
await window.loadURL(url.href);
await new Promise<void>((resolve) => {
setTimeout(() => {
window.show();
resolve();
}, 1000);
});
return window;
}
// #region Auto Launch // #region Auto Launch
@ -592,7 +628,23 @@ try {
return; return;
} }
setTimeout(createWindow, 400); setTimeout(async () => {
const splash = await createSplashWindow();
createWindow();
await new Promise<void>((resolve, reject) => {
try {
setTimeout(() => {
splash.close();
if (!minimized) win?.show();
resolve();
}, 2600);
}
catch(error: any) {
reject(error);
}
});
}, 400);
}); });
// Quit when all windows are closed. // Quit when all windows are closed.

16
src/splash.html Normal file
View file

@ -0,0 +1,16 @@
<html>
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #212529;
background-image: url('./assets/icons/monero-symbol-on-white-480.png');
background-repeat: no-repeat;
background-position: center;
}
</style>
</head>
<body>
</body>
</html>