1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 01:19:59 +02:00

fix: Fixed context menu not updating when right clicking the workspace icon, b=no-bug, c=workspaces

This commit is contained in:
mr. m 2025-06-16 11:45:08 +02:00
parent 5cd1f77e2d
commit ab2a982bf0
No known key found for this signature in database
GPG key ID: 419302196C23B258

View file

@ -1167,7 +1167,8 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} else {
openInContainerMenuItem.setAttribute('hidden', 'true');
}
const target = event.explicitOriginalTarget?.closest('toolbarbutton');
// Call parent node as on windows, the text can be double clicked
const target = event.explicitOriginalTarget?.parentNode?.closest('toolbarbutton');
this.#contextMenuData = {
workspaceId: target?.getAttribute('zen-workspace-id'),
originalTarget: target,
@ -1191,7 +1192,11 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
item.className = 'zen-workspace-context-menu-item';
item.setAttribute('zen-workspace-id', workspace.uuid);
item.setAttribute('disabled', workspace.uuid === this.activeWorkspace);
item.setAttribute('label', (workspace.icon ?? ' \u25CB ') + ' ' + workspace.name);
let name = workspace.name;
if (workspace.icon && workspace.icon !== '') {
name = `${workspace.icon} ${name}`;
}
item.setAttribute('label', name);
item.addEventListener('command', (e) => {
this.changeWorkspaceWithID(e.target.closest('menuitem').getAttribute('zen-workspace-id'));
});