Skip to content

Commit f7bc97b

Browse files
committed
Added keyboard shortcut for code selection
1 parent 40a5602 commit f7bc97b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

frontend/background.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ chrome.runtime.onMessage.addListener((request, _, sendResponse) => {
4040
return true;
4141
}
4242
});
43+
//Default commmand = Alt+T , Mac = Option+T
44+
chrome.commands.onCommand.addListener((command) => {
45+
if (command === "enable-code-selection") {
46+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
47+
if (tabs.length > 0) {
48+
chrome.tabs.sendMessage(tabs[0].id, { type: "ENABLE_PICKER" });
49+
}
50+
});
51+
}
52+
});

frontend/manifest.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,13 @@
3838
"resources": ["packages/prism.css"],
3939
"matches": ["<all_urls>"]
4040
}
41-
]
41+
],
42+
"commands": {
43+
"enable-code-selection": {
44+
"suggested_key": {
45+
"default": "Alt+T"
46+
},
47+
"description": "Activate code selection mode."
48+
}
49+
}
4250
}

0 commit comments

Comments
 (0)