Skip to content

Add Cmd+Up/Down workspace navigation#37

Merged
trydis merged 2 commits intomainfrom
workspace-nav
Apr 1, 2026
Merged

Add Cmd+Up/Down workspace navigation#37
trydis merged 2 commits intomainfrom
workspace-nav

Conversation

@trydis
Copy link
Copy Markdown
Owner

@trydis trydis commented Apr 1, 2026

Navigate to the previous/next workspace using Cmd+Up and Cmd+Down arrows, wrapping around at the edges. Shortcuts are also exposed in the Workspace menu for discoverability.

Summary by CodeRabbit

  • New Features
    • Added "Previous Workspace" and "Next Workspace" commands to the Workspace menu
    • Added keyboard shortcuts (Cmd+Up / Cmd+Down) to navigate between workspaces
    • Workspace navigation cycles through available workspaces (wraparound)
    • Commands are disabled when only one workspace is active
    • Improved handling of Command-only keypresses for workspace navigation

Navigate to the previous/next workspace using Cmd+Up and Cmd+Down
arrows, wrapping around at the edges. Shortcuts are also exposed
in the Workspace menu for discoverability.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7d516edd-a708-4e36-93a4-44e20383347f

📥 Commits

Reviewing files that changed from the base of the PR and between bdd4c67 and b03a42b.

📒 Files selected for processing (2)
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Shortcuts.swift
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift
✅ Files skipped from review due to trivial changes (1)
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Shortcuts.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift

📝 Walkthrough

Walkthrough

Adds two workspace navigation commands and keyboard shortcuts (Command+UpArrow, Command+DownArrow) plus shortcut handling and manager methods to cycle selection to the previous/next workspace with wraparound; commands are disabled when there is ≤1 workspace.

Changes

Cohort / File(s) Summary
Workspace Navigation
Sources/Shellraiser/App/ShellraiserApp.swift, Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Shortcuts.swift, Sources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift
Added "Previous Workspace" and "Next Workspace" menu commands with Command+Up/Down shortcuts; added early handling for Command-only Up/Down keyCodes in shortcut interceptor; added selectPreviousWorkspace() and selectNextWorkspace() methods that compute wrapped adjacent indices and select the target workspace. Menu items are disabled when workspace count ≤ 1.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppCommands as ShellraiserApp.Commands
    participant Shortcuts as WorkspaceManager+Shortcuts
    participant Manager as WorkspaceManager
    participant Window as Window/Sidebar

    User->>AppCommands: Press Cmd+Up / Cmd+Down
    AppCommands->>Shortcuts: Deliver key event
    Shortcuts->>Shortcuts: Check modifiers (Command-only) and keyCode
    alt Cmd+Up/Down matched
        Shortcuts->>Manager: selectPreviousWorkspace() / selectNextWorkspace()
        Manager->>Window: read workspaces & selectedWorkspaceId
        Manager->>Manager: compute wrapped target index
        Manager->>Window: selectWorkspace(targetId)
        Window->>AppCommands: UI selection updates
    else Not matched
        Shortcuts->>Shortcuts: fallback handling / ignore
    end
Loading
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Cmd+Up/Down workspace navigation' directly and clearly summarizes the main change: adding keyboard shortcuts (Cmd+Up/Down) for workspace navigation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workspace-nav

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/Shellraiser/Services/Workspaces/WorkspaceManager`+Shortcuts.swift:
- Around line 59-70: The handler currently always returns true for Cmd+Up/Down
even when no workspace switch occurs, swallowing the event; modify the logic
around hasCommand/... and the keyCode switch to only claim the event when a
workspace change actually happened — either make selectPreviousWorkspace() and
selectNextWorkspace() return a Bool indicating success and return that Bool, or
check workspace count/validity before calling and only return true if a switch
occurred; update the switch branch for event.keyCode and the surrounding
condition to consult that success value before returning true.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 661913eb-5b86-45b4-afcf-b86c8b8791ae

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd6aae and bdd4c67.

📒 Files selected for processing (3)
  • Sources/Shellraiser/App/ShellraiserApp.swift
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Shortcuts.swift
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift

Return Bool from selectPreviousWorkspace/selectNextWorkspace so the
shortcut handler only consumes the event when a switch actually
happened — e.g. with a single workspace the key is now passed
through to the terminal.
@trydis trydis merged commit aeeed87 into main Apr 1, 2026
2 checks passed
@trydis trydis deleted the workspace-nav branch April 1, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant