Merge branch 'dev' into window-sync

This commit is contained in:
mr. m
2025-12-22 11:10:36 +01:00
10 changed files with 113 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd1ad3ca35 100644
index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..450316b7e18852cc088479e9a5fb5832cee88ace 100644
--- a/browser/components/sessionstore/SessionStore.sys.mjs
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -127,6 +127,8 @@ const TAB_EVENTS = [
@@ -133,11 +133,11 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd
// collect the data for all windows
for (ix in this._windows) {
- if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab) {
+ if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab || this._windows[ix].isZenUnsynced) {
+ if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab && !this._windows[ix].isZenUnsynced) {
// window data is still in _statesToRestore
continue;
}
@@ -5625,11 +5650,16 @@ var SessionStoreInternal = {
@@ -5625,11 +5650,12 @@ var SessionStoreInternal = {
}
let tabbrowser = aWindow.gBrowser;
@@ -147,15 +147,21 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd
let winData = this._windows[aWindow.__SSi];
let tabsData = (winData.tabs = []);
+ winData.activeZenSpace = aWindow.gZenWorkspaces?.activeWorkspace || null;
+ winData.splitViewData = aWindow.gZenViewSplitter?.storeDataForSessionStore();
+ winData.folders = aWindow.gZenFolders?.storeDataForSessionStore() || [];
+ winData.spaces = aWindow.gZenWorkspaces?.getWorkspaces();
+
// update the internal state data for this window
for (let tab of tabs) {
if (tab == aWindow.FirefoxViewHandler.tab) {
@@ -5652,7 +5682,7 @@ var SessionStoreInternal = {
@@ -5640,6 +5666,9 @@ var SessionStoreInternal = {
tabsData.push(tabData);
}
+ winData.folders = aWindow.gZenFolders?.storeDataForSessionStore() || [];
+ winData.activeZenSpace = aWindow.gZenWorkspaces?.activeWorkspace || null;
+ winData.spaces = aWindow.gZenWorkspaces?.getWorkspaces();
// update tab group state for this window
winData.groups = [];
for (let tabGroup of aWindow.gBrowser.tabGroups) {
@@ -5652,7 +5681,7 @@ var SessionStoreInternal = {
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
// since it's only inserted into the tab strip after it's selected).
if (aWindow.FirefoxViewHandler.tab?.selected) {
@@ -164,7 +170,7 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd
winData.title = tabbrowser.tabs[0].label;
}
winData.selected = selectedIndex;
@@ -5765,8 +5795,8 @@ var SessionStoreInternal = {
@@ -5765,8 +5794,8 @@ var SessionStoreInternal = {
// selectTab represents.
let selectTab = 0;
if (overwriteTabs) {
@@ -175,6 +181,14 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd
selectTab = Math.min(selectTab, winData.tabs.length);
}
@@ -5788,6 +5817,7 @@ var SessionStoreInternal = {
if (overwriteTabs) {
for (let i = tabbrowser.browsers.length - 1; i >= 0; i--) {
if (!tabbrowser.tabs[i].selected) {
+ aWindow.gZenWorkspaces._shouldOverrideTabs = true;
tabbrowser.removeTab(tabbrowser.tabs[i]);
}
}
@@ -5821,6 +5851,9 @@ var SessionStoreInternal = {
savedTabGroup => !openTabGroupIdsInWindow.has(savedTabGroup.id)
);

View File

@@ -1038,14 +1038,20 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
let tab = window.gBrowser.getTabForBrowser(browser);
const ignoreSplit = tab.hasAttribute('zen-dont-split-glance');
tab.removeAttribute('zen-dont-split-glance');
let isGlanceTab = false;
if (tab.hasAttribute('zen-glance-tab') && !ignoreSplit) {
// Extract from parent node so we are not selecting the wrong (current) tab
tab = tab.parentNode.closest('.tabbrowser-tab');
isGlanceTab = true;
console.assert(tab, 'Tab not found for zen-glance-tab');
}
if (tab) {
this.updateSplitView(tab);
tab.linkedBrowser.docShellIsActive = true;
if (isGlanceTab) {
// See issues https://github.com/zen-browser/desktop/issues/11641
this.removeSplitters();
}
}
this._maybeRemoveFakeBrowser();
{
@@ -1192,7 +1198,9 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
const oldView = this.currentView;
const newView = this._data.findIndex((group) => group.tabs.includes(tab));
if (oldView === newView) return;
if (newView === oldView && oldView < 0) {
return;
}
if (newView < 0 && oldView >= 0) {
this.deactivateCurrentSplitView();
return;
@@ -1980,40 +1988,43 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
this._data.push(data);
this.activateSplitView(data);
gBrowser.selectedTab = emptyTab;
window.addEventListener(
'ZenURLBarClosed',
(event) => {
const { onElementPicked, onSwitch } = event.detail;
const groupIndex = this._data.findIndex((group) => group.tabs.includes(emptyTab));
const newSelectedTab = gBrowser.selectedTab;
const cleanup = () => {
this.removeTabFromGroup(emptyTab, groupIndex, { changeTab: !onSwitch, forUnsplit: true });
const command = document.getElementById('cmd_zenNewEmptySplit');
command.removeAttribute('disabled');
};
if (onElementPicked) {
if (
newSelectedTab === emptyTab ||
newSelectedTab === selectedTab ||
selectedTab.getAttribute('zen-workspace-id') !==
newSelectedTab.getAttribute('zen-workspace-id')
) {
cleanup();
return;
}
this.removeTabFromGroup(emptyTab, groupIndex, { forUnsplit: true });
gBrowser.selectedTab = selectedTab;
this.resetTabState(emptyTab, false);
this.splitTabs([selectedTab, newSelectedTab], 'grid', 1);
} else {
cleanup();
}
},
{ once: true }
);
setTimeout(() => {
window.addEventListener(
'ZenURLBarClosed',
(event) => {
const { onElementPicked, onSwitch } = event.detail;
const groupIndex = this._data.findIndex((group) => group.tabs.includes(emptyTab));
const newSelectedTab = gBrowser.selectedTab;
const cleanup = () => {
this.removeTabFromGroup(emptyTab, groupIndex, {
changeTab: !onSwitch,
forUnsplit: true,
});
const command = document.getElementById('cmd_zenNewEmptySplit');
command.removeAttribute('disabled');
};
if (onElementPicked) {
if (
newSelectedTab === emptyTab ||
newSelectedTab === selectedTab ||
selectedTab.getAttribute('zen-workspace-id') !==
newSelectedTab.getAttribute('zen-workspace-id')
) {
cleanup();
return;
}
this.removeTabFromGroup(emptyTab, groupIndex, { forUnsplit: true });
gBrowser.selectedTab = selectedTab;
this.resetTabState(emptyTab, false);
this.splitTabs([selectedTab, newSelectedTab], 'grid', 1);
} else {
cleanup();
}
},
{ once: true }
);
gZenUIManager.handleNewTab(false, false, 'tab', true);
}, 0);
});
}
get splitViewBrowsers() {

View File

@@ -67,7 +67,7 @@
#tabbrowser-tabpanels[zen-split-view='true'] .browserSidebarContainer.deck-selected {
&:not(.zen-glance-overlay) {
outline: 2px solid var(--zen-primary-color) !important;
outline: 2px solid light-dark(var(--zen-primary-color), var(--button-background-color-primary)) !important;
}
&.zen-glance-overlay {

View File

@@ -141,7 +141,10 @@
position: relative;
opacity: 1;
align-items: center;
padding: 0 5px;
@media (-moz-platform: macos) {
padding: 0 5px;
}
& toolbarseparator {
height: 1px;

View File

@@ -912,6 +912,7 @@ class nsZenWorkspaces {
const cleanup = () => {
delete this._tabToSelect;
delete this._tabToRemoveForEmpty;
delete this._shouldOverrideTabs;
resolveSelectPromise();
};
@@ -927,7 +928,7 @@ class nsZenWorkspaces {
delete this._initialTab;
}
if (this._tabToRemoveForEmpty && !removedEmptyTab) {
if (this._tabToRemoveForEmpty && !removedEmptyTab && !this._shouldOverrideTabs) {
const tabs = gBrowser.tabs.filter((tab) => !tab.collapsed);
if (
typeof this._tabToSelect === 'number' &&