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

feat: Insert workspace names on the context menu for easier switch, b=no-bug, c=workspaces

This commit is contained in:
mr. m 2025-06-16 01:15:11 +02:00
parent a17a1da3b8
commit 5cd1f77e2d
No known key found for this signature in database
GPG key ID: 419302196C23B258
4 changed files with 23 additions and 2 deletions

2
l10n

@ -1 +1 @@
Subproject commit 0268dc81cf7ffadc670d2868decb1d7cd0fc5f59
Subproject commit 706b33337345e4231e18313463259703b3fbc50d

View file

@ -23,6 +23,7 @@
hide-if-usercontext-disabled="true">
<menupopup />
</menu>
<menuseparator id="context_zenWorkspacesSeparator"/>
<menuseparator/>
<menuitem id="context_zenReorderWorkspaces" data-l10n-id="zen-workspaces-panel-context-reorder" command="cmd_zenReorderWorkspaces"/>
<menuseparator/>

View file

@ -1180,6 +1180,26 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
themePicker.hidden =
this.#contextMenuData.workspaceId &&
this.#contextMenuData.workspaceId !== this.activeWorkspace;
const separator = document.getElementById('context_zenWorkspacesSeparator');
for (const item of event.target.querySelectorAll('.zen-workspace-context-menu-item')) {
item.remove();
}
if (!this.#contextMenuData.workspaceId) {
separator.hidden = false;
for (const workspace of [...this._workspaceCache.workspaces].reverse()) {
const item = document.createXULElement('menuitem');
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);
item.addEventListener('command', (e) => {
this.changeWorkspaceWithID(e.target.closest('menuitem').getAttribute('zen-workspace-id'));
});
separator.after(item);
}
} else {
separator.hidden = true;
}
event.target.addEventListener(
'popuphidden',
() => {

View file

@ -19,7 +19,7 @@
"brandShortName": "Zen",
"brandFullName": "Zen Browser",
"release": {
"displayVersion": "1.13.1b",
"displayVersion": "1.13.2b",
"github": {
"repo": "zen-browser/desktop"
},