Skip to content

Commit

Permalink
Merge pull request #286 from rao-pics/284-cmd+q-覆盖掉了其他的菜单事件
Browse files Browse the repository at this point in the history
fix: 🐛 cmd+q-覆盖掉了其他的菜单事件
  • Loading branch information
meetqy authored Jun 29, 2023
2 parents 47f7c48 + b033cb7 commit f233098
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ createAllIPCHandler();
*/
createMenu();

/**
* Hide dock
*/
if (process.platform === "darwin") {
app.dock.hide();
}

let nextjsWebChild: cp.ChildProcess | undefined;

/**
Expand Down Expand Up @@ -68,11 +75,6 @@ app.on("quit", () => {
}
});

/** Hide dock */
if (process.platform === "darwin") {
app.dock.hide();
}

/**
* @see https://www.electronjs.org/docs/latest/api/app#event-activate-macos Event: 'activate'.
*/
Expand Down
11 changes: 11 additions & 0 deletions apps/electron/main/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const createMenu = () => {
{
label: app.name,
submenu: [
{ role: "about" },
{ type: "separator" },
{ role: "services" },
{ type: "separator" },
{ role: "hide" },
{ role: "hideOthers" },
{ role: "unhide" },
{ type: "separator" },
{
label: "Quit",
accelerator: "CmdOrCtrl+Q",
Expand All @@ -21,6 +29,9 @@ const createMenu = () => {
},
],
},
{ role: "editMenu" },
{ role: "viewMenu" },
{ role: "windowMenu" },
]);
Menu.setApplicationMenu(menu);
};
Expand Down

0 comments on commit f233098

Please sign in to comment.