mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 23:19:58 +02:00
Fixed workspace cycle using shortcuts
This commit is contained in:
parent
2a6755d9ba
commit
50afebec5f
1 changed files with 8 additions and 1 deletions
|
@ -786,7 +786,14 @@ var ZenWorkspaces = {
|
|||
let activeWorkspace = workspaces.workspaces.find((workspace) => workspace.used);
|
||||
let workspaceIndex = workspaces.workspaces.indexOf(activeWorkspace);
|
||||
// note: offset can be negative
|
||||
let nextWorkspace = workspaces.workspaces[(workspaceIndex + offset + workspaces.workspaces.length) % workspaces.workspaces.length];
|
||||
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);
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue