diff --git a/src/_locales b/src/_locales index bdaa012..4f5188f 160000 --- a/src/_locales +++ b/src/_locales @@ -1 +1 @@ -Subproject commit bdaa01291b7367a5e815470fd263ea36c862fe32 +Subproject commit 4f5188f3ba55916db3d74345abbbe651e2e8be78 diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 3e7cddc..f2ff7d3 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -14,7 +14,7 @@ const backgroundLogic = { NUMBER_OF_KEYBOARD_SHORTCUTS: 10, unhideQueue: [], - async init() { + init() { browser.commands.onCommand.addListener(async function (command) { if (command === "sort_tabs") { backgroundLogic.sortTabs(); @@ -36,19 +36,7 @@ const backgroundLogic = { } if (command === reopenKey) { - const currentTab = await browser.tabs.query({active: true, currentWindow: true}); - if (currentTab.length > 0) { - const tab = currentTab[0]; - - await browser.tabs.create({ - url: tab.url, - cookieStoreId: cookieStoreId, - index: tab.index + 1, - active: tab.active - }); - - await browser.tabs.remove(tab.id); - } + backgroundLogic.reopenInContainer(cookieStoreId); return; } } @@ -88,12 +76,27 @@ const backgroundLogic = { browser.commands.reset("sort_tabs"); } } + + async reopenInContainer(cookieStoreId) { + const currentTab = await browser.tabs.query({ active: true, currentWindow: true }) + + if (currentTab.length > 0) { + const tab = currentTab[0]; + + browser.tabs.create({ + url: tab.url, + cookieStoreId: cookieStoreId, + index: tab.index + 1, + active: tab.active + }); + + browser.tabs.remove(tab.id); } }, updateTranslationInManifest() { for (let index = 0; index < 10; index++) { - const adjustedIndex = index + 1; + const adjustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI. browser.commands.update({ name: `open_container_${index}`, description: browser.i18n.getMessage("containerShortcut", `${adjustedIndex}`)