diff --git a/README.md b/README.md index a3f8893..8ea22d2 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ If you don't know the difference, pick amd64. Below you can find unofficial packages created by the community. They are not officially supported by us, so before reporting issues, please first confirm the issue also happens on official builds. When in doubt, consult with their packager first. The flatpak and AppImage should work on any distro that [supports them](https://flatpak.org/setup/), so I recommend you just use those instead! - Arch Linux: [Vesktop on the Arch user repository](https://aur.archlinux.org/packages?K=vesktop) -- NixOS: https://nixos.wiki/wiki/Discord#Vesktop +- NixOS: https://wiki.nixos.org/wiki/Discord#Vesktop - Windows - Scoop: https://scoop.sh/#/apps?q=Vesktop ## Building from Source diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index fa4d105..001f8f5 100755 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -13,6 +13,7 @@ import { MenuItemConstructorOptions, nativeImage, nativeTheme, + screen, Tray } from "electron"; import { readFile, rm } from "fs/promises"; @@ -270,7 +271,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; } @@ -318,6 +321,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); diff --git a/src/shared/settings.d.ts b/src/shared/settings.d.ts index a03a766..430a2aa 100644 --- a/src/shared/settings.d.ts +++ b/src/shared/settings.d.ts @@ -37,6 +37,7 @@ export interface State { maximized?: boolean; minimized?: boolean; windowBounds?: Rectangle; + displayid: int; skippedUpdate?: string; firstLaunch?: boolean;