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 7e0afde..3ee1fd0 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -12,6 +12,7 @@ import { Menu, MenuItemConstructorOptions, nativeTheme, + screen, Tray } from "electron"; import { rm } from "fs/promises"; @@ -269,7 +270,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; } @@ -317,6 +320,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 fa46bac..378b625 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;