@devries-cameron20 / t3code-1 / commits / 18b6590d2e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

feat(desktop): add spellcheck suggestions to context menu (#500)

Wire up Electron's context-menu event on webContents to surface dictionary suggestions for misspelled words. Standard edit actions (Cut, Copy, Paste, Select All) appear in all context menus. Related to #473

(CJ) Chukwudi Nwobodo committed Mar 9, 2026 at 01:36 UTC 18b6590d2e490bd73ba968b094dc221ffb7c0f67
1 file changed +28
apps/desktop/src/main.ts
+28
@@ -1114,6 +1114,34 @@ function createWindow(): BrowserWindow {
1114 },
1115 });
1116
1117 + window.webContents.on("context-menu", (event, params) => {
1118 + event.preventDefault();
1119 +
1120 + const menuTemplate: MenuItemConstructorOptions[] = [];
1121 +
1122 + if (params.misspelledWord) {
1123 + for (const suggestion of params.dictionarySuggestions.slice(0, 5)) {
1124 + menuTemplate.push({
1125 + label: suggestion,
1126 + click: () => window.webContents.replaceMisspelling(suggestion),
1127 + });
1128 + }
1129 + if (params.dictionarySuggestions.length === 0) {
1130 + menuTemplate.push({ label: "No suggestions", enabled: false });
1131 + }
1132 + menuTemplate.push({ type: "separator" });
1133 + }
1134 +
1135 + menuTemplate.push(
1136 + { role: "cut", enabled: params.editFlags.canCut },
1137 + { role: "copy", enabled: params.editFlags.canCopy },
1138 + { role: "paste", enabled: params.editFlags.canPaste },
1139 + { role: "selectAll", enabled: params.editFlags.canSelectAll },
1140 + );
1141 +
1142 + Menu.buildFromTemplate(menuTemplate).popup({ window });
1143 + });
1144 +
1145 window.webContents.setWindowOpenHandler(() => ({ action: "deny" }));
1146 window.on("page-title-updated", (event) => {
1147 event.preventDefault();