Skip to content

Commit f9ca9cc

Browse files
committed
fix: Fixed creating workspaces with multiple windows opened, b=no-bug, c=workspaces
1 parent d9646f9 commit f9ca9cc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/zen/workspaces/ZenWorkspaces.mjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
478478
return this.getEssentialsSection(currentWorkspace?.containerTabId);
479479
}
480480

481-
async _createWorkspaceTabsSection(workspace, tabs) {
481+
async _createWorkspaceTabsSection(workspace, tabs = []) {
482482
const workspaceWrapper = document.createXULElement('zen-workspace');
483483
const container = document.getElementById('tabbrowser-arrowscrollbox');
484484
workspaceWrapper.id = workspace.uuid;
@@ -1354,6 +1354,12 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
13541354
detail: { activeIndex: browser.gZenWorkspaces.activeWorkspace },
13551355
})
13561356
);
1357+
for (const workspace of workspaces.workspaces) {
1358+
// Add workspace elements if they dont exist on other windows
1359+
if (!browser.gZenWorkspaces.workspaceElement(workspace.uuid)) {
1360+
await browser.gZenWorkspaces._createWorkspaceTabsSection(workspace);
1361+
}
1362+
}
13571363
}
13581364
await browser.gZenWorkspaces.workspaceBookmarks();
13591365
if (!ignoreStrip) {
@@ -1499,7 +1505,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
14991505
return true;
15001506
}
15011507

1502-
_prepareNewWorkspace(window) {
1508+
#prepareNewWorkspace(window) {
15031509
document.documentElement.setAttribute('zen-workspace-id', window.uuid);
15041510
let tabCount = 0;
15051511
for (let tab of gBrowser.tabs) {
@@ -2320,7 +2326,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
23202326
containerTabId,
23212327
};
23222328
if (moveTabs) {
2323-
this._prepareNewWorkspace(workspace);
2329+
this.#prepareNewWorkspace(workspace);
23242330
await this._createWorkspaceTabsSection(workspace, tabs);
23252331
await this._organizeWorkspaceStripLocations(workspace);
23262332
}

0 commit comments

Comments
 (0)