1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-09 23:45:30 +02:00

Fixed switching workspaces

This commit is contained in:
mr. m 2025-02-13 16:29:34 +01:00
parent ab836eb762
commit d6acd4deb8
No known key found for this signature in database
GPG key ID: 419302196C23B258
4 changed files with 22 additions and 10 deletions

View file

@ -414,7 +414,7 @@ var gZenVerticalTabsManager = {
gBrowser.tabContainer.setAttribute('orient', isVerticalTabs ? 'vertical' : 'horizontal'); gBrowser.tabContainer.setAttribute('orient', isVerticalTabs ? 'vertical' : 'horizontal');
gBrowser.tabContainer.arrowScrollbox.setAttribute('orient', isVerticalTabs ? 'vertical' : 'horizontal'); gBrowser.tabContainer.arrowScrollbox.setAttribute('orient', isVerticalTabs ? 'vertical' : 'horizontal');
// on purpose, we set the orient to horizontal, because the arrowScrollbox is vertical // on purpose, we set the orient to horizontal, because the arrowScrollbox is vertical
gBrowser.tabContainer.arrowScrollbox.scrollbox.setAttribute('orient', isVerticalTabs ? 'horizontal' : 'vertical'); gBrowser.tabContainer.arrowScrollbox.scrollbox.setAttribute('orient', (isVerticalTabs && ZenWorkspaces.workspaceEnabled) ? 'horizontal' : 'vertical');
const buttonsTarget = document.getElementById('zen-sidebar-top-buttons-customization-target'); const buttonsTarget = document.getElementById('zen-sidebar-top-buttons-customization-target');
if (isRightSide) { if (isRightSide) {

View file

@ -457,6 +457,7 @@
max-height: var(--zen-workspace-indicator-height); max-height: var(--zen-workspace-indicator-height);
min-height: var(--zen-workspace-indicator-height); min-height: var(--zen-workspace-indicator-height);
gap: 12px; gap: 12px;
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
flex-direction: row !important; flex-direction: row !important;

View file

@ -1500,7 +1500,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
} }
async _animateTabs(newWorkspace, shouldAnimate) { async _animateTabs(newWorkspace, shouldAnimate, tabToSelect = null) {
this._animatingChange = true; this._animatingChange = true;
const animations = []; const animations = [];
const workspaces = await this._workspaces(); const workspaces = await this._workspaces();
@ -1534,11 +1534,18 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
if (offset === 0) { if (offset === 0) {
element.setAttribute('active', 'true'); element.setAttribute('active', 'true');
if (tabToSelect) {
gBrowser.selectedTab = tabToSelect;
tabToSelect._visuallySelected = false;
}
} else { } else {
element.removeAttribute('active'); element.removeAttribute('active');
} }
} }
await Promise.all(animations); await Promise.all(animations);
if (tabToSelect) {
tabToSelect._visuallySelected = false;
}
this._animatingChange = false; this._animatingChange = false;
} }
@ -1618,7 +1625,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
tabToSelect = newTab; tabToSelect = newTab;
} }
tabToSelect._visuallySelected = true; tabToSelect._visuallySelected = true;
this._lastSelectedWorkspaceTabs[window.uuid] = tabToSelect;
// Always make sure we always unselect the tab from the old workspace // Always make sure we always unselect the tab from the old workspace
if (currentSelectedTab && currentSelectedTab !== tabToSelect) { if (currentSelectedTab && currentSelectedTab !== tabToSelect) {
@ -1641,8 +1647,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
gZenThemePicker.onWorkspaceChange(window); gZenThemePicker.onWorkspaceChange(window);
await this._animateTabs(window, !onInit && !this._animatingChange); await this._animateTabs(window, !onInit && !this._animatingChange, tabToSelect);
gBrowser.selectedTab = tabToSelect;
// Notify listeners // Notify listeners
if (this._changeListeners?.length) { if (this._changeListeners?.length) {

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..c90119b4b248887fd8612beb9aac83c6eeb57088 100644 index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..364bd46b5244c13139dec5a7f9401dbef2582976 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js --- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -406,11 +406,39 @@ @@ -406,11 +406,39 @@
@ -57,8 +57,12 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..c90119b4b248887fd8612beb9aac83c6
} }
aTab.setAttribute("pinned", "true"); aTab.setAttribute("pinned", "true");
this._updateTabBarForPinnedTabs(); this._updateTabBarForPinnedTabs();
@@ -831,7 +859,7 @@ @@ -828,10 +856,10 @@
this.tabContainer.arrowScrollbox.prepend(aTab); // the moving of a tab from the vertical pinned tabs container
// and back into arrowscrollbox.
aTab.removeAttribute("pinned");
- this.tabContainer.arrowScrollbox.prepend(aTab);
+ ZenWorkspaces.activeWorkspaceStrip.prepend(aTab);
}); });
} else { } else {
- this.moveTabTo(aTab, this.pinnedTabCount - 1, { - this.moveTabTo(aTab, this.pinnedTabCount - 1, {
@ -112,11 +116,13 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..c90119b4b248887fd8612beb9aac83c6
aTab.linkedPanel = uniqueId; aTab.linkedPanel = uniqueId;
// Inject the <browser> into the DOM if necessary. // Inject the <browser> into the DOM if necessary.
@@ -2447,7 +2484,7 @@ @@ -2446,8 +2483,8 @@
// If we transitioned from one browser to two browsers, we need to set
// hasSiblings=false on both the existing browser and the new browser. // hasSiblings=false on both the existing browser and the new browser.
if (this.tabs.length == 2) { if (this.tabs.length == 2) {
this.tabs[0].linkedBrowser.browsingContext.hasSiblings = true; - this.tabs[0].linkedBrowser.browsingContext.hasSiblings = true;
- this.tabs[1].linkedBrowser.browsingContext.hasSiblings = true; - this.tabs[1].linkedBrowser.browsingContext.hasSiblings = true;
+ if (this.tabs[0].linkedBrowser.browsingContext) this.tabs[0].linkedBrowser.browsingContext.hasSiblings = true;
+ if (this.tabs[1].linkedBrowser.browsingContext) this.tabs[1].linkedBrowser.browsingContext.hasSiblings = true; + if (this.tabs[1].linkedBrowser.browsingContext) this.tabs[1].linkedBrowser.browsingContext.hasSiblings = true;
} else { } else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;