mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 19:29:58 +02:00
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:
commit
41193b2050
1 changed files with 14 additions and 0 deletions
|
@ -18,6 +18,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
true,
|
true,
|
||||||
this._expandWorkspacesStrip.bind(this)
|
this._expandWorkspacesStrip.bind(this)
|
||||||
);
|
);
|
||||||
|
XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
|
this,
|
||||||
|
'shouldForceContainerTabsToWorkspace',
|
||||||
|
'zen.workspaces.force-container-workspace',
|
||||||
|
true
|
||||||
|
);
|
||||||
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
||||||
await ZenWorkspacesStorage.init();
|
await ZenWorkspacesStorage.init();
|
||||||
if(!Weave.Service.engineManager.get("workspaces")) {
|
if(!Weave.Service.engineManager.get("workspaces")) {
|
||||||
|
@ -879,6 +885,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
return [userContextId, false];
|
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 activeWorkspace = this.getActiveWorkspaceFromCache();
|
||||||
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;
|
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue