Open new tabs right beside their opener (aka. parent) tab or beside the currently active tab
Inspired by "Open Tabs Next to Current" and "Always Right"
which i took a look at and found them to be a little to bi/complex. Lines of JS Code comparision:
"Open Tabs Next to Current" (166), "Always Right" (121) and "Open Right Beside" (27). And no that is no typo. 27 Lines of code. I's so small, i'll even post it here:
code of background.js:
let prevTabId = null;
let actiTabId = null;
async function onActivated(activeInfo) {
prevTabId = activeInfo.previousTabId;
actiTabId = activeInfo.tabId;
}
async function onCreated(newTab) {
let activeTab = null;
if (newTab.id === actiTabId) {
activeTab = await browser.tabs.get(prevTabId);
} else {
activeTab = await browser.tabs.get(actiTabId);
}
if (newTab.windowId === activeTab.windowId) {
browser.tabs.move(newTab.id, {
index: activeTab.index + 1
});
prevTabId = newTab.id;
}
}
browser.tabs.onActivated.addListener(onActivated);
browser.tabs.onCreated.addListener(onCreated);
Sidenote
For people who think that the about:config setting now replaces this.
Let me just say, that i found this behaviour to have been inconsistent and that is why i prefer to create this solution which as of yet never let me down.
Usage:
- install the add-on
- open tabs
- Permissions:
- tabs, to position the new tabs
If you think this could be improved please let me know by opening an issue and i will try to look into it.
More Details on the individual permission can be found here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions
- Cost/Payment:
This Add-on is and forever will be subscription and payment free to use for everyone however they like.
If you are feeling generous you can send me a tip via my bitcoin address 35WK2GqZHPutywCdbHKa9BQ52GND3Pd6h4
- Stars/Reviews:
If you found this add-on useful leave some stars or a review so others can find it too.
- Bugs, Suggestions and Requests:
If you have any (e.g. a site it does not work but you think it should) or have improvement suggestions or feature request please open issue here at the "Support site".
- License: BSD 2-Clause "Simplified" License
- Weekly downloads: 1
- Average daily users: 9
- Rating: 5/5 of 2 ratings
- Created: 2022-09-12 09:28:32
- Last updated: 2022-09-12 10:10:14
- Homepage:
- Support site and email
- Orig: https://addons.mozilla.org/en-US/firefox/addon/open-right-beside/
- API: {34c70c1d-2b58-4942-a706-bf0d73455896}