Fixed pinned tabs separator using the wrong tabs when hiding

This commit is contained in:
mr. m
2025-02-12 15:35:37 +01:00
parent bd4f9788cc
commit 23d9487ca7
2 changed files with 17 additions and 2 deletions

View File

@@ -509,6 +509,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._initializeWorkspaceTabContextMenus();
await this.workspaceBookmarks();
window.addEventListener('TabBrowserInserted', this.onTabBrowserInserted.bind(this));
window.addEventListener('TabOpen', this.updateTabsContainers.bind(this));
window.addEventListener('TabClose', this.updateTabsContainers.bind(this));
let workspaces = await this._workspaces();
let activeWorkspace = null;
if (workspaces.workspaces.length === 0) {
@@ -1721,6 +1723,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return workspaceData;
}
updateTabsContainers() {
this.onPinnedTabsResize([this.pinnedTabsContainer]);
}
updateShouldHideSeparator(arrowScrollbox, pinnedContainer) {
const shouldHideSeparator = pinnedContainer.children.length === 1 || arrowScrollbox.children.length === 1;
if (shouldHideSeparator) {
pinnedContainer.setAttribute('hide-separator', 'true');
} else {
pinnedContainer.removeAttribute('hide-separator');
}
}
onPinnedTabsResize(entries) {
if (!this.workspaceEnabled) {
return;
@@ -1731,6 +1746,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
`#tabbrowser-arrowscrollbox .zen-workspace-tabs-section[zen-workspace-id="${workspaceId}"]`
);
this._updateMarginTopPinnedTabs(arrowScrollbox, entry.target);
this.updateShouldHideSeparator(arrowScrollbox, entry.target);
}
}