mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 23:15:29 +02:00
Refactor ZenKeyboardShortcuts to add zenChangeWorkspaceBack shortcut
This commit is contained in:
parent
ae56ffc365
commit
ef5da75e5e
2 changed files with 6 additions and 3 deletions
|
@ -775,12 +775,13 @@ var ZenWorkspaces = {
|
|||
await this.openEditDialog(this._contextMenuId);
|
||||
},
|
||||
|
||||
async changeWorkspaceShortcut() {
|
||||
async changeWorkspaceShortcut(offset = 1) {
|
||||
// Cycle through workspaces
|
||||
let workspaces = await this._workspaces();
|
||||
let activeWorkspace = workspaces.workspaces.find((workspace) => workspace.used);
|
||||
let workspaceIndex = workspaces.workspaces.indexOf(activeWorkspace);
|
||||
let nextWorkspace = workspaces.workspaces[workspaceIndex + 1] || workspaces.workspaces[0];
|
||||
// note: offset can be negative
|
||||
let nextWorkspace = workspaces.workspaces[(workspaceIndex + offset + workspaces.workspaces.length) % workspaces.workspaces.length];
|
||||
this.changeWorkspace(nextWorkspace);
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue