Open the Heynote window when menu bar icon is left-clicked on Mac

This commit is contained in:
Jonatan Heyman 2024-01-26 01:42:29 +01:00
parent fdfce3d9c8
commit a5088a48af

View File

@ -201,11 +201,18 @@ function createTray() {
}
tray = new Tray(img);
tray.setToolTip("Heynote");
tray.setContextMenu(getTrayMenu(win));
tray.addListener("click", () => {
if (!isMac) {
win?.show()
const menu = getTrayMenu(win)
if (isMac) {
// using tray.setContextMenu() on macOS will open the menu on left-click, so instead we'll
// manually bind the right-click event to open the menu
tray.addListener("right-click", () => {
tray?.popUpContextMenu(menu)
})
} else {
tray.setContextMenu(menu);
}
tray.addListener("click", () => {
win?.show()
})
}