Skip to content

Commit 60e2cab

Browse files
committedFeb 23, 2025··
Add logic to conditionally hide non-essential tabs in pinned tab management
1 parent 12891ab commit 60e2cab

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

‎src/browser/base/zen-components/ZenPinnedTabManager.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@
290290
}
291291
}
292292
gBrowser.tabContainer._invalidateCachedTabs();
293-
294293
newTab.initialize();
294+
if (!ZenWorkspaces.essentialShouldShowTab(newTab)) {
295+
gBrowser.hideTab(newTab, undefined, true);
296+
}
295297
}
296298

297299
gBrowser._updateTabBarForPinnedTabs();

‎src/browser/base/zen-components/ZenWorkspaces.mjs

+15
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
16661666
return prevTabUsed;
16671667
}
16681668

1669+
// Only use it in gZenPinnedTabsManager, when initializing essential tabs
1670+
essentialShouldShowTab(tab) {
1671+
if (tab.getAttribute('zen-essential') !== 'true') {
1672+
return true;
1673+
}
1674+
const workspaces = this._workspaceCache;
1675+
if (!workspaces) {
1676+
return true;
1677+
}
1678+
const containerId = (
1679+
workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) || {}
1680+
)?.containerTabId?.toString();
1681+
return this._shouldShowTab(tab, this.activeWorkspace, containerId, workspaces);
1682+
}
1683+
16691684
_shouldShowTab(tab, workspaceUuid, containerId, workspaces) {
16701685
const isEssential = tab.getAttribute('zen-essential') === 'true';
16711686
const tabWorkspaceId = tab.getAttribute('zen-workspace-id');

0 commit comments

Comments
 (0)
Please sign in to comment.