Fixed workspace cycling with shortcuts

This commit is contained in:
mauro-balades 2024-09-29 19:03:26 +02:00
parent 50afebec5f
commit cc4f1a3eb2

View file

@ -786,15 +786,8 @@ var ZenWorkspaces = {
let activeWorkspace = workspaces.workspaces.find((workspace) => workspace.used);
let workspaceIndex = workspaces.workspaces.indexOf(activeWorkspace);
// note: offset can be negative
if (workspaceIndex + offset >= workspaces.workspaces.length) {
workspaceIndex = 0;
} else if (workspaceIndex + offset < 0) {
workspaceIndex = workspaces.workspaces.length - 1;
} else {
workspaceIndex += offset;
}
let nextWorkspace = workspaces.workspaces[workspaceIndex];
this.changeWorkspace(nextWorkspace);
let nextWorkspace = workspaces.workspaces[(workspaceIndex + offset + workspaces.workspaces.length) % workspaces.workspaces.length];
await this.changeWorkspace(nextWorkspace);
},
_initializeWorkspaceTabContextMenus() {