Skip to content

Enhancement: Ctrl+Tab / Ctrl+Shift+Tab cycles through tabs in the current workspace #51

Description

@JoshuaRowePhantom

Summary

Ctrl+Tab should activate the next tab in the current workspace pane; Ctrl+Shift+Tab should activate the previous tab. This mirrors the convention in browsers, VS Code, and other tabbed applications.

Proposed implementation

Follows the same pattern as #50 (Ctrl+W):

  1. Add ActivateNextTabCommand and ActivatePreviousTabCommand to MainWindowViewModel, each as a no-parameter RelayCommand:

    • Find the active workspace pane's document dock.
    • Collect documentDock.VisibleDockables.OfType<WorkspaceDocument>() as an ordered list.
    • Find the index of documentDock.ActiveDockable.
    • Advance (or retreat) by one, wrapping around at both ends.
    • Call dockFactory.SetActiveDockable(nextDocument) and dockFactory.SetFocusedDockable(documentDock, nextDocument).
  2. Register KeyBindings in MainWindow.axaml:

    <Window.KeyBindings>
        <KeyBinding Gesture="Ctrl+Tab"       Command="{Binding ActivateNextTabCommand}" />
        <KeyBinding Gesture="Ctrl+Shift+Tab" Command="{Binding ActivatePreviousTabCommand}" />
    </Window.KeyBindings>

Notes

  • Both commands are no-ops when the workspace has fewer than two tabs.
  • Avalonia window-level KeyBindings fire after the focused control has had a chance to handle the key, so controls that mark Ctrl+Tab as handled will suppress the binding naturally.
  • Cycle order should follow the visual tab strip order (VisibleDockables index), not MRU order, to be predictable.

Affected files

  • Phantom.Workspaces/ViewModels/MainWindowViewModel.cs — add ActivateNextTabCommand, ActivatePreviousTabCommand
  • Phantom.Workspaces/MainWindow.axaml — add KeyBinding entries for Ctrl+Tab and Ctrl+Shift+Tab

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestverifiedIssue has been verified

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions