summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-08-24 16:08:34 +0300
committerAndrej Mihajlov <and@mullvad.net>2018-08-27 16:19:47 +0300
commite65cc35f2c045a24d0ee6c3e4166ecadba42c25e (patch)
treeaae43da4fc3c87b6fc7f6f2b1a5b981edc94edd0
parenta4e15840b135fc90106647772a733fed72fcd7b6 (diff)
downloadmullvadvpn-e65cc35f2c045a24d0ee6c3e4166ecadba42c25e.tar.xz
mullvadvpn-e65cc35f2c045a24d0ee6c3e4166ecadba42c25e.zip
Detect the current active screen based tray icon location
-rw-r--r--CHANGELOG.md3
-rw-r--r--gui/packages/desktop/src/main/window-controller.js7
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 97c76bd4af..5774c87369 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,9 @@ Line wrap the file at 100 chars. Th
- The CLI command to list relays is now shorter, `mullvad relay list` instead of
`mullvad relay list locations`.
+### Fixed
+- Fix incorrect window position when using external display.
+
## [2018.2] - 2018-08-13
This release is identical to 2018.2-beta3
diff --git a/gui/packages/desktop/src/main/window-controller.js b/gui/packages/desktop/src/main/window-controller.js
index 9e30529dda..dc6165c5f3 100644
--- a/gui/packages/desktop/src/main/window-controller.js
+++ b/gui/packages/desktop/src/main/window-controller.js
@@ -36,8 +36,11 @@ class AttachedToTrayWindowPositioning implements WindowPositioning {
const windowBounds = window.getBounds();
const trayBounds = this._tray.getBounds();
- const primaryDisplay = screen.getPrimaryDisplay();
- const workArea = primaryDisplay.workArea;
+ const activeDisplay = screen.getDisplayNearestPoint({
+ x: trayBounds.x,
+ y: trayBounds.y,
+ });
+ const workArea = activeDisplay.workArea;
const placement = this._getTrayPlacement();
const maxX = workArea.x + workArea.width - windowBounds.width;
const maxY = workArea.y + workArea.height - windowBounds.height;