From 9deefeb0191b3fce3e3a2d19fde5183861b247fb Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sun, 2 Jun 2024 19:13:53 +0530 Subject: [PATCH] window-rect --- desktop/src/main/stores/user-preferences.ts | 34 ++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/desktop/src/main/stores/user-preferences.ts b/desktop/src/main/stores/user-preferences.ts index f3b1929892..e777e538ef 100644 --- a/desktop/src/main/stores/user-preferences.ts +++ b/desktop/src/main/stores/user-preferences.ts @@ -4,17 +4,35 @@ interface UserPreferences { hideDockIcon?: boolean; skipAppVersion?: string; muteUpdateNotificationVersion?: string; + /** + * The last position size of our app's window, saved when the app is closed. + * + * This value is saved when the app is about to quit, and is used to restore + * the window to the previous state when it restarts. + * + * If the user maximizes the window then this value is cleared and instead + * we just re-maximize the window on restart. This is also the behaviour if + * no previously saved `windowRect` is found. + */ + windowRect?: { + x: number; + y: number; + width: number; + height: number; + }; } const userPreferencesSchema: Schema = { - hideDockIcon: { - type: "boolean", - }, - skipAppVersion: { - type: "string", - }, - muteUpdateNotificationVersion: { - type: "string", + hideDockIcon: { type: "boolean" }, + skipAppVersion: { type: "string" }, + muteUpdateNotificationVersion: { type: "string" }, + windowRect: { + properties: { + x: { type: "number" }, + y: { type: "number" }, + width: { type: "number" }, + height: { type: "number" }, + }, }, };