From f7bc97b3c7ef1eb89bb3b932701e784efab3adff Mon Sep 17 00:00:00 2001 From: hemanth5055 Date: Wed, 6 Aug 2025 17:25:41 +0530 Subject: [PATCH 1/2] Added keyboard shortcut for code selection --- frontend/background.js | 10 ++++++++++ frontend/manifest.json | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/background.js b/frontend/background.js index 43c6832..da166fd 100644 --- a/frontend/background.js +++ b/frontend/background.js @@ -40,3 +40,13 @@ chrome.runtime.onMessage.addListener((request, _, sendResponse) => { return true; } }); +//Default commmand = Alt+T , Mac = Option+T +chrome.commands.onCommand.addListener((command) => { + if (command === "enable-code-selection") { + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + if (tabs.length > 0) { + chrome.tabs.sendMessage(tabs[0].id, { type: "ENABLE_PICKER" }); + } + }); + } +}); diff --git a/frontend/manifest.json b/frontend/manifest.json index b9827f2..3a3b320 100644 --- a/frontend/manifest.json +++ b/frontend/manifest.json @@ -38,5 +38,13 @@ "resources": ["packages/prism.css"], "matches": [""] } - ] + ], + "commands": { + "enable-code-selection": { + "suggested_key": { + "default": "Alt+T" + }, + "description": "Activate code selection mode." + } + } } From 91a3f79c930281ab058be67953a15ef9c943fa71 Mon Sep 17 00:00:00 2001 From: hemanth5055 Date: Wed, 6 Aug 2025 21:42:49 +0530 Subject: [PATCH 2/2] Changed keyboard shortcut --- frontend/background.js | 2 +- frontend/manifest.json | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/background.js b/frontend/background.js index da166fd..9e3c132 100644 --- a/frontend/background.js +++ b/frontend/background.js @@ -42,7 +42,7 @@ chrome.runtime.onMessage.addListener((request, _, sendResponse) => { }); //Default commmand = Alt+T , Mac = Option+T chrome.commands.onCommand.addListener((command) => { - if (command === "enable-code-selection") { + if (command === "translate") { chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { if (tabs.length > 0) { chrome.tabs.sendMessage(tabs[0].id, { type: "ENABLE_PICKER" }); diff --git a/frontend/manifest.json b/frontend/manifest.json index 3a3b320..daf9b1c 100644 --- a/frontend/manifest.json +++ b/frontend/manifest.json @@ -40,11 +40,12 @@ } ], "commands": { - "enable-code-selection": { + "translate": { "suggested_key": { - "default": "Alt+T" + "default": "Alt+Shift+A", + "mac": "Alt+Shift+A" }, - "description": "Activate code selection mode." + "description": "Translate selected text" } } }