feat: register Switch to tab 1..9 commands#545
Open
Andr3y- wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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