diff --git a/src/background.js b/src/background.js index 43d69509a1..7b961c21ca 100644 --- a/src/background.js +++ b/src/background.js @@ -5,6 +5,7 @@ import { createProtocol } from "vue-cli-plugin-electron-builder/lib"; import installExtension, { VUEJS3_DEVTOOLS } from "electron-devtools-installer"; import fs from "fs"; import path from "path"; +import { setMenuItems } from "./menu"; import updateApp from "./update"; const isDevelopment = process.env.NODE_ENV !== "production"; @@ -417,6 +418,7 @@ app.on("ready", async () => { } createWindow(); + setMenuItems(); updateApp(mainWindow); }); diff --git a/src/menu.js b/src/menu.js new file mode 100644 index 0000000000..0a0baa5d91 --- /dev/null +++ b/src/menu.js @@ -0,0 +1,19 @@ +import { Menu, MenuItem, shell } from "electron"; + +export const setMenuItems = () => { + const menu = Menu.getApplicationMenu(); + menu.items.forEach((m) => { + if (m.role === "help") { + const submenu = m.submenu; + submenu.append( + new MenuItem({ + label: "View on GitHub", + click: () => { + shell.openExternal("https://github.com/sunner/ChatALL"); + }, + }), + ); + } + }); + Menu.setApplicationMenu(menu); +};