This commit is contained in:
mr. m
2025-02-17 12:21:12 +01:00
278 changed files with 2158 additions and 201 deletions

View File

@@ -1343,10 +1343,18 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return;
}
tab.setAttribute('zen-workspace-id', workspaceID);
const parent = tab.pinned ? '#zen-browser-tabs-pinned ' : '#zen-browser-tabs ';
const container = document.querySelector(parent + '.zen-workspace-tabs-section');
if (tab.hasAttribute('zen-essential')) {
return;
}
const parent = tab.pinned ? '#vertical-pinned-tabs-container ' : '#tabbrowser-arrowscrollbox ';
const container = document.querySelector(parent + `.zen-workspace-tabs-section[zen-workspace-id="${workspaceID}"]`);
if (container) {
container.insertBefore(tab, container.firstChild);
container.insertBefore(tab, container.lastChild);
}
// also change glance tab if it's the same tab
const glanceTab = tab.querySelector('.tabbrowser-tab[zen-glance-tab]');
if (glanceTab) {
glanceTab.setAttribute('zen-workspace-id', workspaceID);
}
}
@@ -1499,7 +1507,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const newTransform = -(workspaceIndex - workspaces.workspaces.indexOf(otherWorkspace)) * 100;
for (const container of document.querySelectorAll(selector)) {
container.style.transform = `translateX(${newTransform + offsetPixels / 2}%)`;
container.style.opacity = offsetPixels ? 1 : !newTransform;
if (!offsetPixels && !container.hasAttribute('active')) {
container.setAttribute('hidden', 'true');
} else {
@@ -1548,16 +1555,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const isCurrent = offset === 0;
if (shouldAnimate) {
element.removeAttribute('hidden');
if (isCurrent) {
element.style.opacity = 1;
}
animations.push(
gZenUIManager.motion.animate(
element,
{
transform: existingTransform ? [existingTransform, newTransform] : newTransform,
// -0 to convert to number
opacity: !isCurrent ? [!!offset - 0, !offset - 0] : [1, 1],
},
{
type: 'spring',
@@ -2015,6 +2017,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
delete this._lastSelectedWorkspaceTabs[previousWorkspaceID];
}
}
// Make sure we select the last tab in the new workspace
this._lastSelectedWorkspaceTabs[workspaceID] = tabs[tabs.length - 1];
const workspaces = await this._workspaces();
await this.changeWorkspace(workspaces.workspaces.find((workspace) => workspace.uuid === workspaceID));
}