Skip to content

Commit

Permalink
duplicate tab without focus no longer relies on the tabs permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbendebiene committed Jun 30, 2019
1 parent 92a47b6 commit 0d638c3
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/core/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@ import {

export function DuplicateTab (data, settings) {
if (settings.focus === false) {
const createTab = browser.tabs.create({
active: false,
url: this.url,
index: this.index + 1,
pinned: this.pinned,
openInReaderMode: this.isInReaderMode,
openerTabId: this.openerTabId
});
createTab.then((tab) => {
browser.tabs.update(tab.id, { muted: this.mutedInfo.muted });
const tabId = this.id;
browser.tabs.onActivated.addListener(function handleDuplicateTabFocus (activeInfo) {
if (activeInfo.previousTabId === tabId) {
browser.tabs.update(tabId, { active: true });
}
browser.tabs.onActivated.removeListener(handleDuplicateTabFocus);
});
}
else {
browser.tabs.duplicate(this.id);
}
browser.tabs.duplicate(this.id);
}


Expand Down

0 comments on commit 0d638c3

Please sign in to comment.