Show main window earlier & adapt to splash colours

This commit is contained in:
Kylie C 2024-08-19 22:01:07 -04:00
parent 422c8afa5c
commit f53f870b53

View file

@ -384,7 +384,7 @@ function initSpellCheck(win: BrowserWindow) {
initSpellCheckLanguages(win, Settings.store.spellCheckLanguages); initSpellCheckLanguages(win, Settings.store.spellCheckLanguages);
} }
function createMainWindow() { function createMainWindow(splash: boolean) {
// Clear up previous settings listeners // Clear up previous settings listeners
removeSettingsListeners(); removeSettingsListeners();
removeVencordSettingsListeners(); removeVencordSettingsListeners();
@ -395,8 +395,10 @@ function createMainWindow() {
const noFrame = frameless === true || customTitleBar === true; const noFrame = frameless === true || customTitleBar === true;
const { splashBackground, splashTheming } = Settings.store;
const win = (mainWin = new BrowserWindow({ const win = (mainWin = new BrowserWindow({
show: false, show: splash,
backgroundColor: splashTheming ? splashBackground : "#313338",
webPreferences: { webPreferences: {
nodeIntegration: false, nodeIntegration: false,
sandbox: false, sandbox: false,
@ -470,7 +472,7 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto
export async function createWindows() { export async function createWindows() {
const startMinimized = process.argv.includes("--start-minimized"); const startMinimized = process.argv.includes("--start-minimized");
const noSplash = process.argv.includes("--no-splash"); const noSplash = process.argv.includes("--no-splash");
let splash = undefined; let splash;
if (!noSplash) { if (!noSplash) {
splash = createSplashWindow(startMinimized); splash = createSplashWindow(startMinimized);
// SteamOS letterboxes and scales it terribly, so just full screen it // SteamOS letterboxes and scales it terribly, so just full screen it
@ -479,15 +481,15 @@ export async function createWindows() {
await ensureVencordFiles(); await ensureVencordFiles();
runVencordMain(); runVencordMain();
mainWin = createMainWindow(); mainWin = createMainWindow(noSplash);
mainWin.webContents.on("did-finish-load", () => { mainWin.webContents.on("did-finish-load", () => {
if (splash) { if (splash) {
splash.destroy(); splash.destroy();
} }
if (!startMinimized) { if (!startMinimized) {
mainWin!.show(); if (!noSplash) mainWin!.show();
if (State.store.maximized && !isDeckGameMode) mainWin!.maximize(); if (State.store.maximized && !isDeckGameMode) mainWin!.maximize();
} }