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

Function installApplicationMenu

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

Source from the content-addressed store, hash-verified

1111};
1112
1113const installApplicationMenu = () => {
1114 const isMac = process.platform === "darwin";
1115 const appMenu: MenuItemConstructorOptions = {
1116 label: app.name,
1117 submenu: [
1118 { role: "about" },
1119 {
1120 label: "Check for Updates…",
1121 click: () => void runUpdateCheck({ alertOnFail: true, trigger: "manual" }),
1122 },
1123 {
1124 label: "Export Diagnostics…",
1125 click: () => void exportDiagnosticsInteractive(),
1126 },
1127 {
1128 label: "Report a Problem…",
1129 click: () => void reportAProblem(),
1130 },
1131 {
1132 label: "Documentation",
1133 click: () => void shell.openExternal("https://executor.sh/docs"),
1134 },
1135 { type: "separator" },
1136 ...(isMac
1137 ? ([
1138 { role: "services" },
1139 { type: "separator" },
1140 { role: "hide" },
1141 { role: "hideOthers" },
1142 { role: "unhide" },
1143 { type: "separator" },
1144 ] as MenuItemConstructorOptions[])
1145 : []),
1146 { role: "quit" },
1147 ],
1148 };
1149 // The close-window accelerator (Cmd+W on macOS, Ctrl+W elsewhere) lives on
1150 // the `close` role, which the File menu carries. The Window menu's role only
1151 // provides Minimize/Zoom/Front, so without an explicit File menu nothing
1152 // binds Cmd+W and the window can't be closed from the keyboard.
1153 const fileMenu: MenuItemConstructorOptions = {
1154 label: "File",
1155 submenu: [{ role: "close" }],
1156 };
1157 // The web shell navigates with browser history (TanStack Router pushState),
1158 // but Electron binds none of the history shortcuts by default and the menu is
1159 // built from roles, none of which carry Back/Forward. So the standard macOS
1160 // Cmd+[ / Cmd+] (Ctrl+[ / Ctrl+] elsewhere) are dead keys inside the desktop
1161 // window, with no browser chrome to fall back on. Bind them here, driving the
1162 // focused window's navigation history. canGo* guards keep the keys no-ops at
1163 // the ends of the stack, matching how they behave in a browser.
1164 const navigateHistory = (direction: "back" | "forward") => {
1165 const nav = BrowserWindow.getFocusedWindow()?.webContents.navigationHistory;
1166 if (!nav) return;
1167 if (direction === "back") {
1168 if (nav.canGoBack()) nav.goBack();
1169 } else if (nav.canGoForward()) {
1170 nav.goForward();

Callers 1

bootFunction · 0.85

Calls 4

reportAProblemFunction · 0.90
runUpdateCheckFunction · 0.85
navigateHistoryFunction · 0.85

Tested by

no test coverage detected