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:
+13
-1
@@ -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();
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user