Fix: Handle essential tabs and container-specific essentials

Refactor workspace switching logic to correctly handle
essential tabs and introduce container-specific essentials.

This change addresses issues with essential tabs not being
handled correctly during workspace switches.

The `changeWorkspace` function is refactored to improve
clarity and maintainability.  The logic for showing and
hiding tabs is streamlined, and tab selection is handled
more robustly.  A new `_shouldShowTab` function is
introduced to centralize the logic for determining tab
visibility based on workspace and container settings.  The
logic also handles pinned essential tabs in the different workspace types.

The pinned tab manager is updated to support container-
specific essentials and to refresh pinned tabs on workspace
changes.  The `_shouldShowPin` function is introduced to
manage visibility of pinned tabs in different workspaces
considering essential tabs, pinned tabs and containers.

This change also fixes a bug where the selected tab would
sometimes be changed unexpectedly when switching
workspaces.
This commit is contained in:
Kristijan Ribarić
2024-11-20 10:00:02 +01:00
parent 245f477760
commit 01c8032f20
4 changed files with 217 additions and 83 deletions

View File

@@ -34,7 +34,6 @@
// Disable smooth scroll
gBrowser.tabContainer.arrowScrollbox.smoothScroll = false;
gZenPinnedTabManager.initTabs();
ZenWorkspaces.init();
gZenUIManager.init();
gZenVerticalTabsManager.init();