Skip to content

Commit 1473675

Browse files
committed
fix: improve workspace session restoration and scrolling behavior
1 parent a6e0368 commit 1473675

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

src/browser/base/content/zen-styles/zen-workspaces.css

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@
130130
overflow: hidden;
131131
display: flex;
132132
gap: 0.5ch;
133+
overflow-x: auto;
134+
scrollbar-width: none;
135+
scroll-behavior: smooth;
133136
}
134137
}
135138

src/browser/base/zen-components/ZenViewSplitter.mjs

+13-1
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
981981
layoutTree: this.calculateLayoutTree(tabs, gridType),
982982
};
983983
this._data.push(splitData);
984-
window.gBrowser.selectedTab = tabs[0];
984+
if (!this._sessionRestoring) {
985+
window.gBrowser.selectedTab = tabs[0];
986+
}
985987

986988
// Add tabs to the split view group
987989
let splitGroup = this._getSplitViewGroup(tabs);
@@ -1739,6 +1741,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
17391741
if (!data) {
17401742
return;
17411743
}
1744+
this._sessionRestoring = true;
17421745
// We can just get the tab group with document.getElementById(group.groupId)
17431746
// and add the tabs to it
17441747
for (const group of data) {
@@ -1748,6 +1751,15 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
17481751
this.splitTabs([...tabs], group.gridType);
17491752
}
17501753
}
1754+
delete this._sessionRestoring;
1755+
}
1756+
1757+
onAfterWorkspaceSessionRestore() {
1758+
if (this.currentView >= 0) {
1759+
// Activate all browsers in the split view
1760+
this.currentView = -1;
1761+
this.onLocationChange(gBrowser.selectedTab.linkedBrowser);
1762+
}
17511763
}
17521764
}
17531765

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

+13
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
405405

406406
_handleSwipeMayStart(event) {
407407
if (!this.workspaceEnabled) return;
408+
if (event.target.closest('#zen-sidebar-bottom-buttons')) return;
408409

409410
// Only handle horizontal swipes
410411
if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) {
@@ -648,6 +649,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
648649
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
649650
BrowserCommands.openTab();
650651
}
652+
gZenViewSplitter.onAfterWorkspaceSessionRestore();
651653
}
652654

653655
handleInitialTab(tab, isEmpty) {
@@ -2415,6 +2417,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
24152417
const maxWidth = 100 / numButtons;
24162418
parent.style.setProperty('--zen-overflowed-workspace-button-width', `${maxWidth}%`);
24172419
this._processingResize = false;
2420+
2421+
// Scroll to the active workspace button if it's not visible
2422+
const activeButton = parent.querySelector('.zen-workspace-button.active');
2423+
if (!activeButton) {
2424+
return;
2425+
}
2426+
const parentRect = parent.getBoundingClientRect();
2427+
const activeRect = activeButton.getBoundingClientRect();
2428+
if (activeRect.left < parentRect.left || activeRect.right > parentRect.right) {
2429+
parent.scrollLeft = activeButton.offsetLeft;
2430+
}
24182431
});
24192432
}
24202433
})();

src/browser/components/sessionstore/SessionStore-sys-mjs.patch

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
2-
index f814772114948f87cbb3c3a7231c95ea1f68d776..ee358a46956d5f09983fa98a202085bac69c8b27 100644
2+
index f814772114948f87cbb3c3a7231c95ea1f68d776..38913eb9dee97b42697440560f7a1bab1ffe9f15 100644
33
--- a/browser/components/sessionstore/SessionStore.sys.mjs
44
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
55
@@ -3171,7 +3171,7 @@ var SessionStoreInternal = {
@@ -54,17 +54,6 @@ index f814772114948f87cbb3c3a7231c95ea1f68d776..ee358a46956d5f09983fa98a202085ba
5454
this._log.debug(
5555
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
5656
);
57-
@@ -5933,8 +5936,8 @@ var SessionStoreInternal = {
58-
let isRemotenessUpdate = options.isRemotenessUpdate;
59-
60-
let willRestoreImmediately =
61-
- options.restoreImmediately || tabbrowser.selectedBrowser == browser;
62-
-
63-
+ options.restoreImmediately || tabbrowser.selectedBrowser == browser
64-
+ || (tabbrowser.selectedTab.group?.id == tab.group?.id);
65-
let isBrowserInserted = browser.isConnected;
66-
67-
// Increase the busy state counter before modifying the tab.
6857
@@ -6086,8 +6089,23 @@ var SessionStoreInternal = {
6958

7059
// Most of tabData has been restored, now continue with restoring

surfer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"binaryName": "zen",
66
"version": {
77
"product": "firefox",
8-
"version": "136.0.2",
8+
"version": "136.0.3",
99
"candidate": "136.0.3"
1010
},
1111
"buildOptions": {
@@ -19,7 +19,7 @@
1919
"brandShortName": "Zen",
2020
"brandFullName": "Zen Browser",
2121
"release": {
22-
"displayVersion": "1.10.1b",
22+
"displayVersion": "1.10.2b",
2323
"github": {
2424
"repo": "zen-browser/desktop"
2525
},
@@ -39,7 +39,7 @@
3939
"brandShortName": "Twilight",
4040
"brandFullName": "Zen Twilight",
4141
"release": {
42-
"displayVersion": "1.10.1t",
42+
"displayVersion": "1.10.2t",
4343
"github": {
4444
"repo": "zen-browser/desktop"
4545
}

0 commit comments

Comments
 (0)