Skip to content

Commit

Permalink
Show main window earlier & adapt to splash colours
Browse files Browse the repository at this point in the history
  • Loading branch information
Covkie committed Aug 20, 2024
1 parent 422c8af commit f53f870
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function initSpellCheck(win: BrowserWindow) {
initSpellCheckLanguages(win, Settings.store.spellCheckLanguages);
}

function createMainWindow() {
function createMainWindow(splash: boolean) {
// Clear up previous settings listeners
removeSettingsListeners();
removeVencordSettingsListeners();
Expand All @@ -395,8 +395,10 @@ function createMainWindow() {

const noFrame = frameless === true || customTitleBar === true;

const { splashBackground, splashTheming } = Settings.store;
const win = (mainWin = new BrowserWindow({
show: false,
show: splash,
backgroundColor: splashTheming ? splashBackground : "#313338",
webPreferences: {
nodeIntegration: false,
sandbox: false,
Expand Down Expand Up @@ -470,7 +472,7 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto
export async function createWindows() {
const startMinimized = process.argv.includes("--start-minimized");
const noSplash = process.argv.includes("--no-splash");
let splash = undefined;
let splash;
if (!noSplash) {
splash = createSplashWindow(startMinimized);
// SteamOS letterboxes and scales it terribly, so just full screen it
Expand All @@ -479,15 +481,15 @@ export async function createWindows() {
await ensureVencordFiles();
runVencordMain();

mainWin = createMainWindow();
mainWin = createMainWindow(noSplash);

mainWin.webContents.on("did-finish-load", () => {
if (splash) {
splash.destroy();
}
}

if (!startMinimized) {
mainWin!.show();
if (!noSplash) mainWin!.show();
if (State.store.maximized && !isDeckGameMode) mainWin!.maximize();
}

Expand Down

0 comments on commit f53f870

Please sign in to comment.