MCPcopy
hub / github.com/ValueCell-ai/ClawX / createMenu

Function createMenu

electron/main/menu.ts:30–226  ·  view source on GitHub ↗
(language?: string)

Source from the content-addressed store, hash-verified

28 * Create application menu
29 */
30export async function createMenu(language?: string): Promise<void> {
31 const isMac = process.platform === 'darwin';
32 const labels = MENU_LABELS[await resolveMenuLanguage(language)];
33
34 const template: Electron.MenuItemConstructorOptions[] = [
35 // App menu (macOS only)
36 ...(isMac
37 ? [
38 {
39 label: app.name,
40 submenu: [
41 { role: 'about' as const, label: applyAppName(labels.app.about) },
42 { type: 'separator' as const },
43 {
44 label: labels.app.preferences,
45 accelerator: 'Cmd+,',
46 click: () => {
47 const win = getMenuTargetWindow();
48 win?.webContents.send('navigate', '/settings');
49 },
50 },
51 { type: 'separator' as const },
52 { role: 'services' as const, label: labels.app.services },
53 { type: 'separator' as const },
54 { role: 'hide' as const, label: applyAppName(labels.app.hide) },
55 { role: 'hideOthers' as const, label: labels.app.hideOthers },
56 { role: 'unhide' as const, label: labels.app.unhide },
57 { type: 'separator' as const },
58 { role: 'quit' as const, label: applyAppName(labels.app.quit) },
59 ],
60 },
61 ]
62 : []),
63
64 // File menu
65 {
66 label: labels.file.label,
67 submenu: [
68 {
69 id: 'new-chat',
70 label: labels.file.newChat,
71 accelerator: 'CmdOrCtrl+N',
72 click: () => {
73 const win = getMenuTargetWindow();
74 win?.webContents.send('new-chat');
75 },
76 },
77 { type: 'separator' },
78 isMac
79 ? { role: 'close', label: labels.file.close }
80 : { role: 'quit', label: applyAppName(labels.app.quit) },
81 ],
82 },
83
84 // Edit menu
85 {
86 label: labels.edit.label,
87 submenu: [

Callers 5

registerSettingsHandlersFunction · 0.90
initializeFunction · 0.90
runSettingsSideEffectsFunction · 0.90
createSettingsApiFunction · 0.90

Calls 3

resolveMenuLanguageFunction · 0.85
applyAppNameFunction · 0.85
getMenuTargetWindowFunction · 0.85

Tested by

no test coverage detected