MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / installApplicationMenu

Function installApplicationMenu

apps/desktop/src/main/index.ts:948–1033  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

946};
947
948const installApplicationMenu = () => {
949 const isMac = process.platform === "darwin";
950 const appMenu: MenuItemConstructorOptions = {
951 label: app.name,
952 submenu: [
953 { role: "about" },
954 {
955 label: "Check for Updates…",
956 click: () => void runUpdateCheck({ alertOnFail: true }),
957 },
958 {
959 label: "Export Diagnostics…",
960 click: () => void exportDiagnosticsInteractive(),
961 },
962 {
963 label: "Report a Problem…",
964 click: () => void reportAProblem(),
965 },
966 {
967 label: "Documentation",
968 click: () => void shell.openExternal("https://executor.sh/docs"),
969 },
970 { type: "separator" },
971 ...(isMac
972 ? ([
973 { role: "services" },
974 { type: "separator" },
975 { role: "hide" },
976 { role: "hideOthers" },
977 { role: "unhide" },
978 { type: "separator" },
979 ] as MenuItemConstructorOptions[])
980 : []),
981 { role: "quit" },
982 ],
983 };
984 // The close-window accelerator (Cmd+W on macOS, Ctrl+W elsewhere) lives on
985 // the `close` role, which the File menu carries. The Window menu's role only
986 // provides Minimize/Zoom/Front, so without an explicit File menu nothing
987 // binds Cmd+W and the window can't be closed from the keyboard.
988 const fileMenu: MenuItemConstructorOptions = {
989 label: "File",
990 submenu: [{ role: "close" }],
991 };
992 // The web shell navigates with browser history (TanStack Router pushState),
993 // but Electron binds none of the history shortcuts by default and the menu is
994 // built from roles, none of which carry Back/Forward. So the standard macOS
995 // Cmd+[ / Cmd+] (Ctrl+[ / Ctrl+] elsewhere) are dead keys inside the desktop
996 // window, with no browser chrome to fall back on. Bind them here, driving the
997 // focused window's navigation history. canGo* guards keep the keys no-ops at
998 // the ends of the stack, matching how they behave in a browser.
999 const navigateHistory = (direction: "back" | "forward") => {
1000 const nav = BrowserWindow.getFocusedWindow()?.webContents.navigationHistory;
1001 if (!nav) return;
1002 if (direction === "back") {
1003 if (nav.canGoBack()) nav.goBack();
1004 } else if (nav.canGoForward()) {
1005 nav.goForward();

Callers 1

bootFunction · 0.85

Calls 4

reportAProblemFunction · 0.90
runUpdateCheckFunction · 0.85
navigateHistoryFunction · 0.85

Tested by

no test coverage detected