Add key combination to open new tab in the same container.

While waiting for Bugzilla bug Bug 1406371 this should be a nice workaround.
The keys Ctrl+Y are now bound to create a new tab in the same container as the current tab.
This commit is contained in:
Tobias Laundal 2017-11-16 20:01:21 +01:00
parent abd2b73fca
commit 36b33c90cb
2 changed files with 20 additions and 0 deletions

View file

@ -177,6 +177,20 @@ const assignManager = {
browser.webRequest.onBeforeRequest.addListener((options) => {
return this.onBeforeRequest(options);
},{urls: ["<all_urls>"], types: ["main_frame"]}, ["blocking"]);
browser.commands.onCommand.addListener(command => {
return this._onCommandHandler(command);
});
},
async _onCommandHandler(command) {
if (command === "new-tab-container") {
return browser.tabs.query({active: true, lastFocusedWindow: true}).then(tabs => {
return tabs[0];
}).then(tab => {
return browser.tabs.create({cookieStoreId: tab.cookieStoreId});
});
}
},
async _onClickedHandler(info, tab) {

View file

@ -38,6 +38,12 @@
"mac": "MacCtrl+Period"
},
"description": "Open containers panel"
},
"new-tab-container": {
"suggested_key": {
"default": "Ctrl+Y"
},
"description": "Open new tab with the same container"
}
},