-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
no-bug: Add keyboard shortcuts to move tabs between workspaces #13668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -628,6 +628,50 @@ class KeyShortcut { | |
| } | ||
| } | ||
|
|
||
| function createMoveTabShortcuts() { | ||
| const shortcuts = []; | ||
| for (let i = 10; i > 0; i--) { | ||
| shortcuts.push( | ||
| new KeyShortcut( | ||
| `zen-move-tab-to-workspace-${i}`, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, I dont think we should have shortcuts to move these to individual spaces, they would clutter up the keyboard shortcuts too much.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your point. My original pain point was that most of the time I use shortcuts for switching between workspaces, and switching between tabs within a workspace (ctrl + [1-9], cmd + [1-9] respectively, on Mac). So when I clicked a link, and it opened the tab in a "wrong" workspace, I'd want to move it to the "correct" one. Since there is already a built-in "Move tab" option, when you right click the tab itself, I thought making a keybind for it would make sense. I also read the issues linked in the description, although those went kind of stale. |
||
| AppConstants.platform == "macosx" ? `${i === 10 ? 0 : i}` : "", | ||
| "", | ||
| ZEN_WORKSPACE_SHORTCUTS_GROUP, | ||
| nsKeyShortcutModifiers.fromObject( | ||
| AppConstants.platform == "macosx" | ||
| ? { ctrl: true, shift: true } | ||
| : {} | ||
| ), | ||
| `cmd_zenMoveTabToWorkspace${i}`, | ||
| `zen-move-tab-shortcut-workspace-${i}` | ||
| ) | ||
| ); | ||
| } | ||
| shortcuts.push( | ||
| new KeyShortcut( | ||
| "zen-move-tab-forward", | ||
| "", | ||
| "", | ||
| ZEN_WORKSPACE_SHORTCUTS_GROUP, | ||
| nsKeyShortcutModifiers.fromObject({}), | ||
| "cmd_zenMoveTabForward", | ||
| "zen-move-tab-shortcut-forward" | ||
| ) | ||
| ); | ||
| shortcuts.push( | ||
| new KeyShortcut( | ||
| "zen-move-tab-backward", | ||
| "", | ||
| "", | ||
| ZEN_WORKSPACE_SHORTCUTS_GROUP, | ||
| nsKeyShortcutModifiers.fromObject({}), | ||
| "cmd_zenMoveTabBackward", | ||
| "zen-move-tab-shortcut-backward" | ||
| ) | ||
| ); | ||
| return shortcuts; | ||
| } | ||
|
|
||
| class nsZenKeyboardShortcutsLoader { | ||
| constructor() {} | ||
|
|
||
|
|
@@ -749,6 +793,8 @@ class nsZenKeyboardShortcutsLoader { | |
| ) | ||
| ); | ||
|
|
||
| newShortcutList.push(...createMoveTabShortcuts()); | ||
|
|
||
| // Split view | ||
| newShortcutList.push( | ||
| new KeyShortcut( | ||
|
|
@@ -832,7 +878,7 @@ class nsZenKeyboardShortcutsLoader { | |
| } | ||
|
|
||
| class nsZenKeyboardShortcutsVersioner { | ||
| static LATEST_KBS_VERSION = 18; | ||
| static LATEST_KBS_VERSION = 19; | ||
|
|
||
| constructor() {} | ||
|
|
||
|
|
@@ -1228,6 +1274,12 @@ class nsZenKeyboardShortcutsVersioner { | |
| ); | ||
| } | ||
|
|
||
| if (version < 19) { | ||
| // Migrate from version 18 to 19. | ||
| // Add shortcuts to move tab(s) to workspace 1-10 and forward/backward | ||
| data.push(...createMoveTabShortcuts()); | ||
| } | ||
|
|
||
| return data; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Between spaces right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. Missed putting it into the name