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
1 changed files with 11 additions and 4 deletions

View File

@ -201,11 +201,18 @@ function createTray() {
}
tray = new Tray(img);
tray.setToolTip("Heynote");
tray.setContextMenu(getTrayMenu(win));
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", () => {
if (!isMac) {
win?.show()
}
win?.show()
})
}