Merge branch 'Vencord:main' into main

This commit is contained in:
MrGarlic1 2024-05-15 07:25:08 -04:00 committed by GitHub
commit d142180b46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import {
MenuItemConstructorOptions,
nativeImage,
nativeTheme,
screen,
Tray
} from "electron";
import { rm } from "fs/promises";
@ -278,7 +279,9 @@ function getWindowBoundsOptions(): BrowserWindowConstructorOptions {
height: height ?? DEFAULT_HEIGHT
} as BrowserWindowConstructorOptions;
if (x != null && y != null) {
const storedDisplay = screen.getAllDisplays().find(display => display.id === State.store.displayid);
if (x != null && y != null && storedDisplay) {
options.x = x;
options.y = y;
}
@ -326,6 +329,7 @@ function initWindowBoundsListeners(win: BrowserWindow) {
const saveBounds = () => {
State.store.windowBounds = win.getBounds();
State.store.displayid = screen.getDisplayMatching(State.store.windowBounds).id;
};
win.on("resize", saveBounds);

View file

@ -37,6 +37,7 @@ export interface State {
maximized?: boolean;
minimized?: boolean;
windowBounds?: Rectangle;
displayid: int;
skippedUpdate?: string;
firstLaunch?: boolean;