Add basic shotcuts and hotkeys for simplelogin extension:

- Ctrl+Alt+S to open the extension menu (action menu)
- Ctrl+Alt+X to generate a random email alias
This commit is contained in:
Othmane AJDOR
2020-09-07 22:04:18 +02:00
parent e254fd51b2
commit 36ab60d931
2 changed files with 27 additions and 1 deletions
+13 -1
View File
@@ -2,6 +2,7 @@ import browser from "webextension-polyfill";
import APIService from "../popup/APIService";
import SLStorage from "../popup/SLStorage";
import Onboarding from "./onboarding";
import Utils from "../popup/Utils"
import "./content-script";
import { handleNewRandomAlias } from "./create-alias";
@@ -46,5 +47,16 @@ browser.contextMenus.create({
onclick: handleOnClickContextMenu,
});
/**
* Shortcuts and hotkeys listener
*/
browser.commands.onCommand.addListener(async (command) => {
if (command === "generate-random-alias") {
console.log("generate-random-alias");
const currentTab = (await browser.tabs.query({active: true, currentWindow: true}))[0];
return await handleNewRandomAlias(currentTab.url);
}
});
APIService.initService();
Onboarding.initService();
Onboarding.initService();
+14
View File
@@ -32,5 +32,19 @@
"scripts": [
"background.js"
]
},
"commands": {
"generate-random-alias": {
"suggested_key": {
"default": "Ctrl+Alt+X"
},
"description": "Generate a random email alias"
},
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Alt+S"
},
"description":"Open the extension action menu"
}
}
}