From db9c2acbb30319fa233ebc1efcbe5e94f94c44f8 Mon Sep 17 00:00:00 2001 From: hayao Date: Tue, 13 May 2025 17:24:04 +0900 Subject: [PATCH] Add "Search in Google" Context --- sources/code/main/modules/menu.ts | 9 ++++++++- sources/translations/en/client.json | 3 ++- sources/translations/ja/client.json | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sources/code/main/modules/menu.ts b/sources/code/main/modules/menu.ts index 5b86fad6..a5c3dec4 100644 --- a/sources/code/main/modules/menu.ts +++ b/sources/code/main/modules/menu.ts @@ -67,6 +67,13 @@ export function context(parent: Electron.BrowserWindow): void { enabled: clipboard.availableFormats().length !== 0 && params.editFlags.canPaste, role: "paste" }, + { + label: context.googleSearch, + enabled: params.editFlags.canCopy, + click: () => { + shell.openExternal(`https://www.google.com/search?q=${encodeURIComponent(params.selectionText)}`).catch(commonCatches.throw); + } + }, { type: "separator" } ] satisfies Electron.MenuItemConstructorOptions[] : []), // Copy link text / copy link url @@ -286,4 +293,4 @@ export function bar(repoLink: string, parent: Electron.BrowserWindow): Electron. ]); Menu.setApplicationMenu(menu); return menu; -} \ No newline at end of file +} diff --git a/sources/translations/en/client.json b/sources/translations/en/client.json index e56b1072..44ff5dfc 100644 --- a/sources/translations/en/client.json +++ b/sources/translations/en/client.json @@ -20,7 +20,8 @@ "copyURLText": "Copy link text", "copyImage": "Copy image", "copyImageURL": "Copy link to image", - "inspectElement": "Inspect" + "inspectElement": "Inspect", + "googleSearch": "Search in Google" }, "menubar": { "enabled": "Enabled", diff --git a/sources/translations/ja/client.json b/sources/translations/ja/client.json index c7d3f22c..d320f08a 100644 --- a/sources/translations/ja/client.json +++ b/sources/translations/ja/client.json @@ -8,7 +8,8 @@ "paste": "ペースト", "copyURL": "URLのコピー", "copyImage": "画像のコピー", - "copyImageURL": "画像へのリンクをコピー" + "copyImageURL": "画像へのリンクをコピー", + "googleSearch": "Googleで検索" }, "tray": { "toggle": "トグル",