Fixed a bug in detecting manual changes of keyboard shortcuts

This commit is contained in:
Achiya Elyasaf
2023-11-19 15:35:15 +02:00
parent a640126c2c
commit 693f3f2bce
4 changed files with 31 additions and 15 deletions

View File

@@ -20,13 +20,7 @@ function addListener(commandName) {
})
}
chrome.runtime.onInstalled.addListener((reason) => {
if (reason.reason === chrome.runtime.OnInstalledReason.INSTALL) {
checkCommandShortcuts()
}
})
// Only use this function during the initial install phase. After
// Only use this function during the initial installation phase. After
// installation the user may have intentionally unassigned commands.
// Example for install commands: [{"description":"","name":"_execute_action","shortcut":""},{"description":"Use the selected text to ask GPT. It adds to the beginning of the selected text: 'In Latex, '","name":"Ask","shortcut":""},{"description":"Complete selected text","name":"Complete","shortcut":""},{"description":"Improve selected text","name":"Improve","shortcut":""}]
async function checkCommandShortcuts() {
@@ -45,6 +39,12 @@ async function checkCommandShortcuts() {
})
}
chrome.runtime.onInstalled.addListener((reason) => {
if (reason.reason === chrome.runtime.OnInstalledReason.INSTALL) {
checkCommandShortcuts()
}
})
async function setup() {
addListener('Improve')
addListener('Complete')