MCPcopy Index your code
hub / github.com/21st-dev/1code / buildMenu

Function buildMenu

src/main/index.ts:623–853  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

621
622 // Function to build and set application menu
623 const buildMenu = () => {
624 // Show devtools menu item only in dev mode or when unlocked
625 const showDevTools = !app.isPackaged || devToolsUnlocked
626 const template: Electron.MenuItemConstructorOptions[] = [
627 {
628 label: app.name,
629 submenu: [
630 {
631 label: "About 1Code",
632 click: () => app.showAboutPanel(),
633 },
634 {
635 label: updateAvailable
636 ? `Update to v${availableVersion}...`
637 : "Check for Updates...",
638 click: () => {
639 // Send event to renderer to clear dismiss state
640 const win = getWindow()
641 if (win) {
642 win.webContents.send("update:manual-check")
643 }
644 // If update is already available, start downloading immediately
645 if (updateAvailable) {
646 downloadUpdate()
647 } else {
648 checkForUpdates(true)
649 }
650 },
651 },
652 { type: "separator" },
653 {
654 label: "Settings...",
655 ...(settingsMenuIcon && { icon: settingsMenuIcon }),
656 accelerator: "CmdOrCtrl+,",
657 click: () => {
658 const win = getWindow()
659 if (win) {
660 win.webContents.send("shortcut:open-settings")
661 }
662 },
663 },
664 { type: "separator" },
665 {
666 label: isCliInstalled()
667 ? "Uninstall '1code' Command..."
668 : "Install '1code' Command in PATH...",
669 ...(terminalMenuIcon && { icon: terminalMenuIcon }),
670 click: async () => {
671 const { dialog } = await import("electron")
672 if (isCliInstalled()) {
673 const result = await uninstallCli()
674 if (result.success) {
675 dialog.showMessageBox({
676 type: "info",
677 message: "CLI command uninstalled",
678 detail: "The '1code' command has been removed from your PATH.",
679 })
680 buildMenu()

Callers 3

setUpdateAvailableFunction · 0.85
unlockDevToolsFunction · 0.85
index.tsFile · 0.85

Calls 13

getWindowFunction · 0.90
downloadUpdateFunction · 0.90
checkForUpdatesFunction · 0.90
isCliInstalledFunction · 0.90
uninstallCliFunction · 0.90
installCliFunction · 0.90
hasActiveClaudeSessionsFunction · 0.90
hasActiveCodexStreamsFunction · 0.90
abortAllClaudeSessionsFunction · 0.90
abortAllCodexStreamsFunction · 0.90
setIsQuittingFunction · 0.90
createWindowFunction · 0.90

Tested by

no test coverage detected