executing the shortcut
This commit is contained in:
parent
d6a832153a
commit
edf78fffdc
1 changed files with 11 additions and 5 deletions
|
|
@ -70,14 +70,16 @@ browser.contentScripts.register({
|
||||||
runAt: "document_idle"
|
runAt: "document_idle"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let ThunderAI_Shortcut = "Ctrl+Alt+A";
|
||||||
|
|
||||||
// Shortcut
|
// Shortcut
|
||||||
messenger.commands.update({
|
messenger.commands.update({
|
||||||
name: "_thunderai__do_action",
|
name: "_thunderai__do_action",
|
||||||
shortcut: "Ctrl+Alt+A"
|
shortcut: ThunderAI_Shortcut
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
taLog.log('Shortcut registered successfully!');
|
taLog.log('Shortcut [' + ThunderAI_Shortcut + '] registered successfully!');
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
taLog.error('Error registering shortcut: ' + error);
|
taLog.error('Error registering shortcut [' + ThunderAI_Shortcut + ']: ' + error);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen for shortcut command
|
// Listen for shortcut command
|
||||||
|
|
@ -93,7 +95,7 @@ async function handleShortcut(tab) {
|
||||||
if(!["mail", "messageCompose","messageDisplay"].includes(tab.type)){
|
if(!["mail", "messageCompose","messageDisplay"].includes(tab.type)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
browser.tabs.sendMessage(tab.id, { command: "searchPrompt", _prompts_data: menus.shortcutMenu, tab_type: tab.type });
|
browser.tabs.sendMessage(tab.id, { command: "searchPrompt", _prompts_data: menus.shortcutMenu, tabId: tab.id, _tab_type: tab.type });
|
||||||
}
|
}
|
||||||
|
|
||||||
messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
|
messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
|
||||||
|
|
@ -178,6 +180,10 @@ messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) =>
|
||||||
await menus.reload();
|
await menus.reload();
|
||||||
taLog.log("[ThunderAI] Reloaded menus");
|
taLog.log("[ThunderAI] Reloaded menus");
|
||||||
break;
|
break;
|
||||||
|
case 'shortcut_do_prompt':
|
||||||
|
taLog.log("Executing shortcut, promptId: " + message.promptId);
|
||||||
|
menus.executeMenuAction(message.promptId);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -350,7 +356,7 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
|
||||||
});
|
});
|
||||||
|
|
||||||
const listener4 = async (message, sender, sendResponse) => {
|
const listener4 = async (message, sender, sendResponse) => {
|
||||||
console.log(">>>>>>>>>>>>>> message: " + JSON.stringify(message));
|
//console.log(">>>>>>>>>>>>>> message: " + JSON.stringify(message));
|
||||||
if (message.command === "openai_comp_api_ready_"+rand_call_id4) {
|
if (message.command === "openai_comp_api_ready_"+rand_call_id4) {
|
||||||
|
|
||||||
let newWindow4 = await browser.windows.get(message.window_id, {populate: true});
|
let newWindow4 = await browser.windows.get(message.window_id, {populate: true});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue