Add extension shortcut logic for tab sorting
This commit is contained in:
parent
a7aaacd82c
commit
1e413ff71e
2 changed files with 25 additions and 7 deletions
|
@ -15,12 +15,24 @@ const backgroundLogic = {
|
||||||
unhideQueue: [],
|
unhideQueue: [],
|
||||||
init() {
|
init() {
|
||||||
browser.commands.onCommand.addListener(function (command) {
|
browser.commands.onCommand.addListener(function (command) {
|
||||||
for (let i=0; i < backgroundLogic.NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
|
switch (command) {
|
||||||
const key = "open_container_" + i;
|
case "sort_tabs_by_container":
|
||||||
const cookieStoreId = identityState.keyboardShortcut[key];
|
backgroundLogic.sortTabs();
|
||||||
if (command === key) {
|
break;
|
||||||
|
case "open_container_0":
|
||||||
|
case "open_container_1":
|
||||||
|
case "open_container_2":
|
||||||
|
case "open_container_3":
|
||||||
|
case "open_container_4":
|
||||||
|
case "open_container_5":
|
||||||
|
case "open_container_6":
|
||||||
|
case "open_container_7":
|
||||||
|
case "open_container_8":
|
||||||
|
case "open_container_9": {
|
||||||
|
const cookieStoreId = identityState.keyboardShortcut[command];
|
||||||
if (cookieStoreId === "none") return;
|
if (cookieStoreId === "none") return;
|
||||||
browser.tabs.create({cookieStoreId});
|
browser.tabs.create({cookieStoreId});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,6 +43,12 @@
|
||||||
},
|
},
|
||||||
"description": "Open containers panel"
|
"description": "Open containers panel"
|
||||||
},
|
},
|
||||||
|
"sort_tabs_by_container": {
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Ctrl+Comma"
|
||||||
|
},
|
||||||
|
"description": "Sort tabs by container"
|
||||||
|
},
|
||||||
"open_container_0": {
|
"open_container_0": {
|
||||||
"suggested_key": {
|
"suggested_key": {
|
||||||
"default": "Ctrl+Shift+1"
|
"default": "Ctrl+Shift+1"
|
||||||
|
|
Loading…
Add table
Reference in a new issue