diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-11-22 09:13:08 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-11-22 13:13:21 +0100 |
| commit | bcf34bb9fd27136305daeec88ee113324d7a9f09 (patch) | |
| tree | ced164384e00bd8d35a77dd45ca639ca4ab6fc5a /gui/src/main/window-controller.ts | |
| parent | bde1bb119f09d43f11cb720916a54e84f717a685 (diff) | |
| download | mullvadvpn-bcf34bb9fd27136305daeec88ee113324d7a9f09.tar.xz mullvadvpn-bcf34bb9fd27136305daeec88ee113324d7a9f09.zip | |
Move platform version checks to it's own file
Diffstat (limited to 'gui/src/main/window-controller.ts')
| -rw-r--r-- | gui/src/main/window-controller.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gui/src/main/window-controller.ts b/gui/src/main/window-controller.ts index dff90de639..c4d6b47232 100644 --- a/gui/src/main/window-controller.ts +++ b/gui/src/main/window-controller.ts @@ -1,8 +1,8 @@ import { BrowserWindow, Display, screen, Tray, WebContents } from 'electron'; -import os from 'os'; import { IWindowShapeParameters } from '../shared/ipc-types'; import { Scheduler } from '../shared/scheduler'; import { IpcMainEventChannel } from './ipc-event-channel'; +import { isWindows11OrNewer } from './platform-version'; interface IPosition { x: number; @@ -14,10 +14,8 @@ interface IWindowPositioning { getWindowShapeParameters(window: BrowserWindow): IWindowShapeParameters; } -// Tray applications are positioned aproximately 10px from the tray in Windows 11. Windows 11 has -// the internal version 10.0.22000+. -const MARGIN = - process.platform === 'win32' && parseInt(os.release().split('.').at(-1)!) >= 22000 ? 10 : 0; +// Tray applications are positioned aproximately 10px from the tray in Windows 11. +const MARGIN = isWindows11OrNewer() ? 10 : 0; class StandaloneWindowPositioning implements IWindowPositioning { public getPosition(window: BrowserWindow): IPosition { |
