Skip to content

Commit

Permalink
Add logic to conditionally hide non-essential tabs in pinned tab mana…
Browse files Browse the repository at this point in the history
…gement
  • Loading branch information
mauro-balades committed Feb 23, 2025
1 parent 12891ab commit 60e2cab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/browser/base/zen-components/ZenPinnedTabManager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@
}
}
gBrowser.tabContainer._invalidateCachedTabs();

newTab.initialize();
if (!ZenWorkspaces.essentialShouldShowTab(newTab)) {
gBrowser.hideTab(newTab, undefined, true);
}
}

gBrowser._updateTabBarForPinnedTabs();
Expand Down
15 changes: 15 additions & 0 deletions src/browser/base/zen-components/ZenWorkspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return prevTabUsed;
}

// Only use it in gZenPinnedTabsManager, when initializing essential tabs
essentialShouldShowTab(tab) {
if (tab.getAttribute('zen-essential') !== 'true') {
return true;
}
const workspaces = this._workspaceCache;
if (!workspaces) {
return true;
}
const containerId = (
workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) || {}
)?.containerTabId?.toString();
return this._shouldShowTab(tab, this.activeWorkspace, containerId, workspaces);
}

_shouldShowTab(tab, workspaceUuid, containerId, workspaces) {
const isEssential = tab.getAttribute('zen-essential') === 'true';
const tabWorkspaceId = tab.getAttribute('zen-workspace-id');
Expand Down

0 comments on commit 60e2cab

Please sign in to comment.