mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-06 01:46:35 +00:00
Add logic to conditionally hide non-essential tabs in pinned tab management
This commit is contained in:
@@ -290,8 +290,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gBrowser.tabContainer._invalidateCachedTabs();
|
gBrowser.tabContainer._invalidateCachedTabs();
|
||||||
|
|
||||||
newTab.initialize();
|
newTab.initialize();
|
||||||
|
if (!ZenWorkspaces.essentialShouldShowTab(newTab)) {
|
||||||
|
gBrowser.hideTab(newTab, undefined, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gBrowser._updateTabBarForPinnedTabs();
|
gBrowser._updateTabBarForPinnedTabs();
|
||||||
|
@@ -1666,6 +1666,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
return prevTabUsed;
|
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) {
|
_shouldShowTab(tab, workspaceUuid, containerId, workspaces) {
|
||||||
const isEssential = tab.getAttribute('zen-essential') === 'true';
|
const isEssential = tab.getAttribute('zen-essential') === 'true';
|
||||||
const tabWorkspaceId = tab.getAttribute('zen-workspace-id');
|
const tabWorkspaceId = tab.getAttribute('zen-workspace-id');
|
||||||
|
Reference in New Issue
Block a user