change state to store display id only
This commit is contained in:
parent
7dcf6a153c
commit
5083019fd0
2 changed files with 6 additions and 4 deletions
src
|
@ -270,7 +270,9 @@ function getWindowBoundsOptions(): BrowserWindowConstructorOptions {
|
|||
height: height ?? DEFAULT_HEIGHT
|
||||
} as BrowserWindowConstructorOptions;
|
||||
|
||||
if (x != null && y != null && State.store.display && screen.getAllDisplays().includes(State.store.display)) {
|
||||
const storedDisplay = screen.getAllDisplays().find(display => display.id === State.store.displayid);
|
||||
|
||||
if (x != null && y != null && storedDisplay) {
|
||||
options.x = x;
|
||||
options.y = y;
|
||||
}
|
||||
|
@ -318,7 +320,7 @@ function initWindowBoundsListeners(win: BrowserWindow) {
|
|||
|
||||
const saveBounds = () => {
|
||||
State.store.windowBounds = win.getBounds();
|
||||
State.store.display = screen.getDisplayMatching(State.store.windowBounds);
|
||||
State.store.displayid = screen.getDisplayMatching(State.store.windowBounds).id;
|
||||
};
|
||||
|
||||
win.on("resize", saveBounds);
|
||||
|
|
4
src/shared/settings.d.ts
vendored
4
src/shared/settings.d.ts
vendored
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
*/
|
||||
|
||||
import type { Display, Rectangle } from "electron";
|
||||
import type { Rectangle } from "electron";
|
||||
|
||||
export interface Settings {
|
||||
discordBranch?: "stable" | "canary" | "ptb";
|
||||
|
@ -36,7 +36,7 @@ export interface State {
|
|||
maximized?: boolean;
|
||||
minimized?: boolean;
|
||||
windowBounds?: Rectangle;
|
||||
display?: Display;
|
||||
displayid: int;
|
||||
|
||||
skippedUpdate?: string;
|
||||
firstLaunch?: boolean;
|
||||
|
|
Reference in a new issue