Merge pull request #53 from kristijanribaric/feature/force-container-tabs-to-open-in-assigned-workspace

Feature: Force container tabs to a workspace where that container is set as default
This commit is contained in:
mr. m 🤙 2024-10-14 17:24:07 +02:00 committed by GitHub
commit 41193b2050
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,6 +18,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
true,
this._expandWorkspacesStrip.bind(this)
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
'shouldForceContainerTabsToWorkspace',
'zen.workspaces.force-container-workspace',
true
);
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
await ZenWorkspacesStorage.init();
if(!Weave.Service.engineManager.get("workspaces")) {
@ -879,6 +885,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return [userContextId, false];
}
if(this.shouldForceContainerTabsToWorkspace && typeof userContextId !== 'undefined' && this._workspaceCache?.workspaces) {
const workspace = this._workspaceCache.workspaces.find((workspace) => workspace.containerTabId === userContextId);
if(workspace && workspace.uuid !== this.getActiveWorkspaceFromCache().uuid) {
this.changeWorkspace(workspace);
return [userContextId, true];
}
}
const activeWorkspace = this.getActiveWorkspaceFromCache();
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;