Skip to content

no-bug: Add keyboard shortcuts to move tabs between workspaces#13668

Open
kristof-nyr wants to merge 2 commits into
zen-browser:devfrom
kristof-nyr:feat/keybind-move-tab-to-workspace
Open

no-bug: Add keyboard shortcuts to move tabs between workspaces#13668
kristof-nyr wants to merge 2 commits into
zen-browser:devfrom
kristof-nyr:feat/keybind-move-tab-to-workspace

Conversation

@kristof-nyr
Copy link
Copy Markdown

Summary

Adds 12 new keyboard shortcuts to move the active (or multiselected) tabs to a specific workspace or to the next/previous workspace.

Addresses community requests in:

What's included

  • Commands: 12 new <command> elements in zen-commands.inc.xhtml
  • Move logic: shortcutMoveTabTo(index) and moveActiveTabShortcut(offset)
    in ZenSpaceManager.mjs; empty tabs (zen-empty-tab) are filtered out to
    prevent moving placeholder tabs
  • Feedback: Toast notification ("Moved tab to [name]" / "Moved N tabs to
    [name]") using existing gZenUIManager.showToast; the toast container's ARIA
    live region provides screenreader announcements automatically
  • Shortcuts: Registered in ZenKeyboardShortcuts.mjs with migration to
    version 19; extracted shared createMoveTabShortcuts() factory so fresh-install
    and migration paths cannot diverge
  • Defaults: Ctrl+Shift+1..0 on macOS (mirrors Ctrl+1..0 for switching);
    unbound on other platforms
  • Tests: 10 mochitest tasks covering single move, multiselect, wrap/no-wrap,
    same-workspace guard, empty-tab fallback, and toast verification

Design decisions

Behavioral note for reviewers

In zen-sets.js, the default case was reordered: workspace-switch and
move-tab commands are now checked before gZenGlanceManager.handleMainCommandSet().
Previously the glance manager saw all default-case commands including workspace
switches. The new order only passes truly unrecognized commands to the glance
manager. This is more correct (workspace commands aren't glance-related) but
reviewers should confirm the glance manager doesn't depend on seeing those events.

Signed-off-by: Kristof Nyari <nyari.kristof66@gmail.com>
Signed-off-by: Kristof Nyari <nyari.kristof66@gmail.com>
@kristof-nyr kristof-nyr requested a review from mr-cheffy as a code owner May 12, 2026 13:46
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. Feature labels May 12, 2026
<command id="cmd_zenMoveTabToWorkspace8" />
<command id="cmd_zenMoveTabToWorkspace9" />
<command id="cmd_zenMoveTabToWorkspace10" />
<command id="cmd_zenMoveTabForward" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between spaces right?

Copy link
Copy Markdown
Author

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

for (let i = 10; i > 0; i--) {
shortcuts.push(
new KeyShortcut(
`zen-move-tab-to-workspace-${i}`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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.
If you know any existing way to address my pain point, or propose alternatives, I'm open to collaborate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants