This commit is contained in:
mr. M
2025-03-26 19:24:38 +01:00
6 changed files with 36 additions and 25 deletions

View File

@@ -130,6 +130,9 @@
overflow: hidden;
display: flex;
gap: 0.5ch;
overflow-x: auto;
scrollbar-width: none;
scroll-behavior: smooth;
}
}

View File

@@ -192,15 +192,6 @@ class ZenMediaController {
this._currentBrowser = browser;
this.updatePipButton();
const positionState = mediaController.getPositionState();
this.mediaControllersMap.set(mediaController.id, {
controller: mediaController,
browser,
position: positionState.position,
duration: positionState.duration,
lastUpdated: Date.now(),
});
}
setupMediaControlUI(metadata, positionState) {
@@ -244,6 +235,7 @@ class ZenMediaController {
browser,
position: positionState.position,
duration: positionState.duration,
playbackRate: positionState.playbackRate,
lastUpdated: Date.now(),
});
@@ -292,6 +284,7 @@ class ZenMediaController {
...mediaController,
position: event.position,
duration: event.duration,
playbackRate: event.playbackRate,
lastUpdated: Date.now(),
});
@@ -333,6 +326,7 @@ class ZenMediaController {
this.setupMediaControlUI(nextController.controller.getMetadata(), {
position: nextController.position + (nextController.controller.isPlaying ? elapsedTime : 0),
duration: nextController.duration,
playbackRate: nextController.playbackRate,
});
this.showMediaControls();

View File

@@ -981,7 +981,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
layoutTree: this.calculateLayoutTree(tabs, gridType),
};
this._data.push(splitData);
window.gBrowser.selectedTab = tabs[0];
if (!this._sessionRestoring) {
window.gBrowser.selectedTab = tabs[0];
}
// Add tabs to the split view group
let splitGroup = this._getSplitViewGroup(tabs);
@@ -1739,6 +1741,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
if (!data) {
return;
}
this._sessionRestoring = true;
// We can just get the tab group with document.getElementById(group.groupId)
// and add the tabs to it
for (const group of data) {
@@ -1748,6 +1751,15 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
this.splitTabs([...tabs], group.gridType);
}
}
delete this._sessionRestoring;
}
onAfterWorkspaceSessionRestore() {
if (this.currentView >= 0) {
// Activate all browsers in the split view
this.currentView = -1;
this.onLocationChange(gBrowser.selectedTab.linkedBrowser);
}
}
}

View File

@@ -405,6 +405,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
_handleSwipeMayStart(event) {
if (!this.workspaceEnabled) return;
if (event.target.closest('#zen-sidebar-bottom-buttons')) return;
// Only handle horizontal swipes
if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) {
@@ -648,6 +649,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
BrowserCommands.openTab();
}
gZenViewSplitter.onAfterWorkspaceSessionRestore();
}
handleInitialTab(tab, isEmpty) {
@@ -2415,6 +2417,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const maxWidth = 100 / numButtons;
parent.style.setProperty('--zen-overflowed-workspace-button-width', `${maxWidth}%`);
this._processingResize = false;
// Scroll to the active workspace button if it's not visible
const activeButton = parent.querySelector('.zen-workspace-button.active');
if (!activeButton) {
return;
}
const parentRect = parent.getBoundingClientRect();
const activeRect = activeButton.getBoundingClientRect();
if (activeRect.left < parentRect.left || activeRect.right > parentRect.right) {
parent.scrollLeft = activeButton.offsetLeft;
}
});
}
})();