summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--gui/src/main/index.ts15
2 files changed, 15 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7a48559e2..11aeacbcce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,6 +69,7 @@ Line wrap the file at 100 chars. Th
#### MacOS
- Set correct permissions for daemon's launch file in installer.
- Fix downgrades on macOS silently keeping previous version.
+- Fix other menubar context menus not always closing when opening app on macOS 11.
#### Android
- Fix UI sometimes not updating correctly while no split screen or after having a dialog from
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 22ddb47954..4e9aacc85c 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -10,6 +10,7 @@ import {
shell,
Tray,
} from 'electron';
+import os from 'os';
import * as path from 'path';
import { sprintf } from 'sprintf-js';
import * as uuid from 'uuid';
@@ -1764,7 +1765,19 @@ class ApplicationMain {
}
this.tray?.on('click', () => this.windowController?.show());
} else {
- this.tray?.on('click', () => this.windowController?.toggle());
+ this.tray?.on('click', () => {
+ const isMacOsBigSur = process.platform === 'darwin' && parseInt(os.release(), 10) >= 20;
+ if (isMacOsBigSur && !this.windowController?.isVisible()) {
+ // This is a workaround for this Electron issue, when it's resolved
+ // `this.windowController?.toggle()` should do the trick on all platforms:
+ // https://github.com/electron/electron/issues/28776
+ const contextMenu = Menu.buildFromTemplate([]);
+ contextMenu.on('menu-will-show', () => this.windowController?.show());
+ this.tray?.popUpContextMenu(contextMenu);
+ } else {
+ this.windowController?.toggle();
+ }
+ });
this.tray?.on('right-click', () => this.windowController?.hide());
}
}