feat(workspaces): Force container tab to open in workspace where it's assigned as default

This commit introduces a new preference, `zen.workspaces.force-container-workspace`, which allows users to automatically switch to the workspace associated with a specific tab's container.
This commit is contained in:
Kristijan Ribarić 2024-10-14 10:33:09 +02:00
parent 232cb69ccf
commit b66af853f2

View file

@ -879,6 +879,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return [userContextId, false];
}
if(Services.prefs.getBoolPref('zen.workspaces.force-container-workspace', false) && 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).then(() => {
return [userContextId, true];
});
}
}
const activeWorkspace = this.getActiveWorkspaceFromCache();
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;