A way to set tab context as default for new tab

I am decided to develop better Firefox integration with activities than Nepufox. Instead of different Firefox profile, I will switch context and set default tab’s context. I will develop small script to watch activity change and inform Firefox about current activity.

I have few questions.

First: Is there way to set default context for a new tab?

I’m not quite sure what you mean by “context” here.

If you mean Firefox’s contextual identifies, no, you can’t change the default contextual identity used to create new tabs through the default keyboard shortcuts, menus, and UI buttons.

That said, extensions can create new tab using specific contextual identity by providing a cookieStoreId property in tabs.create()'s createProperties object. The Work with contextual identities docs on MDN have a demo extension that does this.

Alternatively, if you have the Firefox Multi-Account Containers add-on installed, you can assign a custom keyboard shortcuts to create a new tab with specific contextual identity. For example, I use Cmd+Shift+1 to create a new tab with my Personal identity.

Sorry for asking this (probably) simple question: Can I add new open new tab button? It will open tab in last context or group of tabs.