From b66af853f29928e77433a317dac8650222a02de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristijan=20Ribari=C4=87?= Date: Mon, 14 Oct 2024 10:33:09 +0200 Subject: [PATCH] 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. --- src/ZenWorkspaces.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index 3989481..b4b4375 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -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;