diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-04-29 14:15:38 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-04-29 14:15:38 +0200 |
| commit | 826f33be6f291b37657302bc61311fc32b8cce5c (patch) | |
| tree | 39c485982a5b90169504cd55b5375467faf71649 /gui/src/main | |
| parent | 6e4e42e8cf58a99c40a08e6ece94556a6596dc73 (diff) | |
| parent | 244348742a204a3ffb23f38cea02d88a27c36449 (diff) | |
| download | mullvadvpn-826f33be6f291b37657302bc61311fc32b8cce5c.tar.xz mullvadvpn-826f33be6f291b37657302bc61311fc32b8cce5c.zip | |
Merge branch 'linux-window-chrome'
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/index.ts | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index b3139362d8..08dc43243b 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -275,7 +275,6 @@ class ApplicationMain { this.registerWindowListener(windowController); this.registerIpcListeners(); - this.setAppMenu(); this.addContextMenu(window); this.windowController = windowController; @@ -311,6 +310,7 @@ class ApplicationMain { break; case 'darwin': this.installMacOsMenubarAppWindowHandlers(tray, windowController); + this.setMacOsAppMenu(); break; case 'linux': this.installGenericMenubarAppWindowHandlers(tray, windowController); @@ -967,7 +967,7 @@ class ApplicationMain { // the size of transparent area around arrow on macOS const headerBarArrowHeight = 12; - const options = { + const options: Electron.BrowserWindowConstructorOptions = { width: 320, minWidth: 320, height: contentHeight, @@ -1003,16 +1003,24 @@ class ApplicationMain { skipTaskbar: true, }); - default: - return new BrowserWindow(options); + default: { + const appWindow = new BrowserWindow({ + ...options, + frame: true, + }); + + return appWindow; + } } } - private setAppMenu() { + // On macOS, hotkeys are bound to the app menu and won't work if it's not set, + // even though the app menu itself is not visible because the app does not appear in the dock. + private setMacOsAppMenu() { const template: Electron.MenuItemConstructorOptions[] = [ { label: 'Mullvad', - submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }], + submenu: [{ role: 'quit' }], }, { label: 'Edit', @@ -1129,7 +1137,7 @@ class ApplicationMain { private installLinuxWindowCloseHandler(windowController: WindowController) { windowController.window.on('close', (closeEvent: Event) => { - if (process.platform === 'linux' && this.quitStage !== AppQuitStage.ready) { + if (this.quitStage !== AppQuitStage.ready) { closeEvent.preventDefault(); windowController.hide(); } |
