feat: Add start minimized as a launch argument (#316)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Redeven 2024-01-06 23:11:00 -03:00 committed by GitHub
parent 0881143d57
commit 0f0bddbef9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View file

@ -446,7 +446,8 @@ function createMainWindow() {
const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js"))); const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js")));
export async function createWindows() { export async function createWindows() {
const splash = createSplashWindow(); const startMinimized = process.argv.includes("--start-minimized");
const 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
if (isDeckGameMode) splash.setFullScreen(true); if (isDeckGameMode) splash.setFullScreen(true);
await ensureVencordFiles(); await ensureVencordFiles();
@ -456,10 +457,10 @@ export async function createWindows() {
mainWin.webContents.on("did-finish-load", () => { mainWin.webContents.on("did-finish-load", () => {
splash.destroy(); splash.destroy();
mainWin!.show();
if (State.store.maximized && !isDeckGameMode) { if (!startMinimized) {
mainWin!.maximize(); mainWin!.show();
if (State.store.maximized && !isDeckGameMode) mainWin!.maximize();
} }
if (isDeckGameMode) { if (isDeckGameMode) {
@ -468,6 +469,12 @@ export async function createWindows() {
askToApplySteamLayout(mainWin); askToApplySteamLayout(mainWin);
} }
mainWin.once("show", () => {
if (State.store.maximized && !mainWin!.isMaximized() && !isDeckGameMode) {
mainWin!.maximize();
}
});
}); });
initArRPC(); initArRPC();

View file

@ -11,10 +11,11 @@ import { ICON_PATH, VIEW_DIR } from "shared/paths";
import { Settings } from "./settings"; import { Settings } from "./settings";
export function createSplashWindow() { export function createSplashWindow(startMinimized = false) {
const splash = new BrowserWindow({ const splash = new BrowserWindow({
...SplashProps, ...SplashProps,
icon: ICON_PATH icon: ICON_PATH,
show: !startMinimized
}); });
splash.loadFile(join(VIEW_DIR, "splash.html")); splash.loadFile(join(VIEW_DIR, "splash.html"));