Skip to content

feat: register Switch to tab 1..9 commands#545

Open
Andr3y- wants to merge 1 commit into
YishenTu:mainfrom
Andr3y-:feat/tab-switch-hotkeys
Open

feat: register Switch to tab 1..9 commands#545
Andr3y- wants to merge 1 commit into
YishenTu:mainfrom
Andr3y-:feat/tab-switch-hotkeys

Conversation

@Andr3y-
Copy link
Copy Markdown

@Andr3y- Andr3y- commented Apr 21, 2026

Exposes nine Obsidian commands (switch-to-tab-1 .. switch-to-tab-9) that activate the Nth tab in the current Claudian view. Surfacing them through addCommand (rather than a view-scoped DOM keydown listener) means:

  • Users rebind in Settings → Hotkeys like any other command.
  • checkCallback hides slots above the current tab count so the command palette stays tidy.
  • Fires from anywhere in Obsidian, not only when the Claudian view has DOM focus.

No default chord is assigned. ⌘/⌥/Ctrl + digit all collide with common OS / browser bindings and the right choice varies per user, so we leave it to the user via Hotkeys. A README note would suggest ⌥1..9 on macOS and Alt+1..9 elsewhere.

Tests: +5 cases in tests/integration/main.test.ts

  • registers all nine commands with the expected names
  • switch-to-tab-1 calls TabManager.switchToTab(tabs[0].id)
  • switch-to-tab-3 is unavailable when only 2 tabs exist
  • unavailable when no Claudian leaf is open
  • unavailable when leaf has no TabManager yet

Exposes nine Obsidian commands (switch-to-tab-1 .. switch-to-tab-9)
that activate the Nth tab in the current Claudian view. Surfacing
them through addCommand (rather than a view-scoped DOM keydown
listener) means:

  - Users rebind in Settings → Hotkeys like any other command.
  - checkCallback hides slots above the current tab count so the
    command palette stays tidy.
  - Fires from anywhere in Obsidian, not only when the Claudian view
    has DOM focus.

No default chord is assigned. ⌘/⌥/Ctrl + digit all collide with
common OS / browser bindings and the right choice varies per user,
so we leave it to the user via Hotkeys. A README note would suggest
⌥1..9 on macOS and Alt+1..9 elsewhere.

Tests: +5 cases in tests/integration/main.test.ts
  - registers all nine commands with the expected names
  - switch-to-tab-1 calls TabManager.switchToTab(tabs[0].id)
  - switch-to-tab-3 is unavailable when only 2 tabs exist
  - unavailable when no Claudian leaf is open
  - unavailable when leaf has no TabManager yet
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