This commit is contained in:
Mr. M
2025-11-02 01:35:46 +01:00
parent d005b97042
commit be561ec8dc
15 changed files with 128 additions and 47 deletions

View File

@@ -2502,7 +2502,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
}
// Only animate if it's from an event
let animateContainer = target && target.target instanceof EventTarget;
if (target?.type === 'TabClose' || target?.type === 'TabOpened') {
if (target?.type === 'TabClose' || target?.type === 'TabOpen') {
animateContainer = target.target.pinned;
}
await this.onPinnedTabsResize(
@@ -2514,14 +2514,29 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
);
}
updateShouldHideSeparator(arrowScrollbox, pinnedContainer) {
updateShouldHideSeparator(arrowScrollbox, pinnedContainer, fromTabSelection = false) {
const visibleTabsFound = () => {
let count = 0;
for (const child of arrowScrollbox.children) {
if (
!child.hasAttribute('hidden') &&
!child.closing &&
!child.hasAttribute('zen-empty-tab')
) {
count++;
if (count > 1) {
// Early return
return true;
}
}
}
return false;
};
// <= 2 because we have the empty tab and the new tab button
const shouldHideSeparator =
pinnedContainer.children.length === 1 ||
Array.from(arrowScrollbox.children).filter(
(child) =>
!child.hasAttribute('hidden') && !child.closing && !child.hasAttribute('zen-empty-tab')
).length <= 1;
const shouldHideSeparator = fromTabSelection
? pinnedContainer.hasAttribute('hide-separator')
: pinnedContainer.children.length === 1 || !visibleTabsFound();
if (shouldHideSeparator) {
pinnedContainer.setAttribute('hide-separator', 'true');
} else {
@@ -2656,7 +2671,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
}
const workspaceID = tab.getAttribute('zen-workspace-id');
const isEssential = tab.getAttribute('zen-essential') === 'true';
this.updateShouldHideSeparator(this.activeWorkspaceStrip, this.pinnedTabsContainer, true);
if (tab.hasAttribute('zen-empty-tab')) {
return;
}