Add lazy pref getter for zen.workspaces.force-container-workspace

This commit is contained in:
Kristijan Ribarić 2024-10-14 10:43:14 +02:00
parent b66af853f2
commit 74bd43f9c9

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,7 +885,7 @@ 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) {
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).then(() => {