Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
Fix mb is undefined when right click on tray icon (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
quanglam2807 authored May 14, 2021
1 parent 11f2c4a commit f6ba12d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions main-src/libs/windows/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const createAsync = () => new Promise((resolve) => {
const contextMenu = Menu.buildFromTemplate([
{
label: 'Open WebCatalog',
click: () => mb.showWindow(),
click: () => get().show(),
},
{
type: 'separator',
Expand All @@ -66,7 +66,7 @@ const createAsync = () => new Promise((resolve) => {
label: 'About WebCatalog',
click: () => {
sendToAllWindows('open-dialog-about');
mb.showWindow();
get().show();
},
},
{
Expand All @@ -83,7 +83,7 @@ const createAsync = () => new Promise((resolve) => {
visible: !registered,
click: registered ? null : () => {
sendToAllWindows('open-license-registration-dialog');
mb.showWindow();
get().show();
},
},
{
Expand All @@ -96,18 +96,22 @@ const createAsync = () => new Promise((resolve) => {
label: 'Preferences...',
click: () => {
sendToAllWindows('go-to-preferences');
mb.showWindow();
get().show();
},
},
{ type: 'separator' },
{
label: 'Quit',
click: () => {
mb.app.quit();
if (attachToMenubar) {
mb.app.quit();
} else {
app.quit();
}
},
},
]);
mb.tray.popUpContextMenu(contextMenu);
(attachToMenubar ? mb.tray : tray).popUpContextMenu(contextMenu);
};

// only supported on macOS
Expand Down

0 comments on commit f6ba12d

Please sign in to comment.