From 54250f4edf248ab3683cba4788deef4539dda577 Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Fri, 3 Nov 2023 21:52:05 +0200 Subject: [PATCH] Fix maximised setting --- source/main/services/config.ts | 5 +++-- source/main/services/windows.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/main/services/config.ts b/source/main/services/config.ts index 296153c2..c79f15b8 100644 --- a/source/main/services/config.ts +++ b/source/main/services/config.ts @@ -16,6 +16,7 @@ interface Config { browserPrivateKey: string | null; browserPublicKey: string | null; fileHostKey: null | string; + isMaximised: boolean; preferences: Preferences; selectedSource: null | string; windowHeight: number; @@ -29,13 +30,13 @@ const DEFAULT_CONFIG: Config = { browserPrivateKey: null, browserPublicKey: null, fileHostKey: null, + isMaximised: false, preferences: naiveClone(PREFERENCES_DEFAULT), selectedSource: null, windowHeight: 600, windowWidth: 800, windowX: null, - windowY: null, - isMaximize: false + windowY: null }; export async function getConfigValue(key: K): Promise { diff --git a/source/main/services/windows.ts b/source/main/services/windows.ts index 8a52078d..d95c0e95 100644 --- a/source/main/services/windows.ts +++ b/source/main/services/windows.ts @@ -19,11 +19,11 @@ export async function closeWindows(): Promise { } async function createVaultWindow() { - const width = await getConfigValue("windowWidth"); - const height = await getConfigValue("windowHeight"); - const x = await getConfigValue("windowX"); - const y = await getConfigValue("windowY"); - const isMaximize = await getConfigValue("isMaximize"); + const width = await getConfigValue("windowWidth"); + const height = await getConfigValue("windowHeight"); + const x = await getConfigValue("windowX"); + const y = await getConfigValue("windowY"); + const isMaximised = await getConfigValue("isMaximised"); const config: BrowserWindowConstructorOptions = { width, height, @@ -39,7 +39,7 @@ async function createVaultWindow() { config.y = y; } const win = new BrowserWindow(config); - if (isMaximize) { + if (isMaximised) { win.maximize(); } enableWebContents(win.webContents); @@ -53,11 +53,11 @@ async function createVaultWindow() { ); win.on("maximize", async () => { - await setConfigValue("isMaximize", win.isMaximized()); + await setConfigValue("isMaximised", win.isMaximized()); }); win.on("unmaximize", async () => { - await setConfigValue("isMaximize", win.isMaximized()); + await setConfigValue("isMaximised", win.isMaximized()); }); win.on(