Function createSplashScreen

  • Creates and displays a splash screen window during application startup. The splash screen is frameless, always-on-top, and transparent with a loading animation.

    Returns void

    Void (splash window stored in module-level variable).

    The splash screen is closed by closeSplashScreen() when the main window is ready.

    function createSplashScreen() {
    return withGroup(`[Main] Create Splash Screen`, () => {
    console.info("[Main] 🎨 Creating splash screen...");
    splashWindow = new BrowserWindow({
    width: 500,
    height: 400,
    transparent: true,
    frame: false,
    alwaysOnTop: true,
    resizable: false,
    webPreferences: {
    sandbox: true,
    contextIsolation: true,
    nodeIntegration: false,
    },
    });

    const splashPath = path.join(getAssetsPath(), "splash.html");

    console.debug(`[Main] 🔍 Loading splash from: ${splashPath}`);
    splashWindow.loadFile(splashPath);
    splashWindow.center();

    // Handle splash loading errors
    splashWindow.webContents.on(
    "did-fail-load",
    (_event, errorCode, errorDesc) => {
    console.error(
    `[Main] ❌ Failed to load splash screen (${errorCode}): ${errorDesc}`,
    );
    },
    );

    console.info("[Main] ✅ Splash screen created");
    });
    }