fix: Improved workspace icons generation, b=(no-bug), c=common, mods, workspaces

This commit is contained in:
Mr. M
2025-05-18 12:29:26 +02:00
parent 246e3b25a4
commit 148a5eebc2
5 changed files with 34 additions and 14 deletions

View File

@@ -58,7 +58,6 @@ var gZenUIManager = {
});
window.addEventListener('TabClose', this.onTabClose.bind(this));
this.tabsWrapper.addEventListener('scroll', this.saveScrollbarState.bind(this));
gZenMediaController.init();
},

View File

@@ -181,7 +181,11 @@ export class ZenThemeMarketplaceParent extends JSWindowActorParent {
}
async installTheme(theme) {
try {
await this.downloadThemeFileContents(theme);
} catch (e) {
console.error('ZenThemeMarketplaceParent: Error installing theme', theme.id, e);
}
}
async checkForThemeChanges() {

View File

@@ -51,22 +51,25 @@
}
}
on_ZenWorkspacesUIUpdate(event) {
this.#updateIcons();
async on_ZenWorkspacesUIUpdate(event) {
await this.#updateIcons();
this.activeIndex = event.detail.activeIndex;
}
set activeIndex(uuid) {
const buttons = this.querySelectorAll('toolbarbutton');
if (!buttons.length) {
return;
}
let i = 0;
let selected = 0;
let selected = -1;
for (const button of buttons) {
if (button.getAttribute('zen-workspace-id') == uuid) {
selected = i;
} else {
button.removeAttribute('active');
}
selected++;
i++;
}
buttons[selected].setAttribute('active', true);
this.setAttribute('selected', selected);

View File

@@ -1594,12 +1594,14 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
browser.gZenWorkspaces._workspaceBookmarksCache = null;
}
let workspaces = await browser.gZenWorkspaces._workspaces();
if (clearCache) {
browser.dispatchEvent(
new CustomEvent('ZenWorkspacesUIUpdate', {
bubbles: true,
detail: { workspaces, activeIndex: browser.gZenWorkspaces.activeWorkspace },
detail: { activeIndex: browser.gZenWorkspaces.activeWorkspace },
})
);
}
await browser.gZenWorkspaces.workspaceBookmarks();
workspaceList.innerHTML = '';
workspaceList.parentNode.style.display = 'flex';
@@ -2102,7 +2104,9 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
element,
{
transform: existingTransform ? [existingTransform, newTransform] : newTransform,
paddingTop: existingTransform ? [existingPaddingTop, existingPaddingTop] : existingPaddingTop,
paddingTop: existingTransform
? [existingPaddingTop, existingPaddingTop]
: existingPaddingTop,
},
{
type: 'spring',
@@ -2441,8 +2445,16 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
tab.setAttribute('zen-workspace-id', workspace.uuid);
}
}
window.dispatchEvent(
new CustomEvent('ZenWorkspacesUIUpdate', {
bubbles: true,
detail: { activeIndex: workspace.uuid },
})
);
}
this.workspaceIcons.activeIndex = workspace.uuid;
setTimeout(gURLBar.formatValue.bind(gURLBar), 0);
}

View File

@@ -11,7 +11,9 @@
align-items: center;
display: flex;
font-size: x-small;
margin: 0 5px;
padding: 0 3px;
margin: 0;
appearance: auto;
position: relative;