Expand description
§Keybinding (Command)
RESPONSIBILITIES:
- Defines Tauri command handlers for keybinding operations from Sky frontend
- Bridges keybinding requests to
KeybindingProvider - Handles keybinding resolution, conflict detection, and extension registration
- Manages user keybinding preferences and extension contributions
ARCHITECTURAL ROLE:
- Command module exposing keybinding functionality via Tauri IPC
(
#[command]) - Delegates to Environment’s
KeybindingProvidervia DI withRequire()trait - Acts as thin façade layer; all logic resides in provider implementation
COMMAND REFERENCE (Tauri IPC):
GetResolvedKeybinding: Get the final resolved keybindings after merging all sourcesGetUserKeybindings: Retrieve user-defined keybinding overrides (stub)RegisterExtensionKeybindings: Register keybindings contributed by an extension (stub)UnregisterExtensionKeybindings: Remove keybindings for an extension (stub)CheckKeybindingConflicts: Check if a keybinding conflicts with existing ones (stub)
ERROR HANDLING:
- Returns
Result<Value, String>where errors sent to frontend - Provider errors converted to strings via
map_err(|Error| Error.to_string()) - TODO: Implement proper conflict detection and user keybinding storage
PERFORMANCE:
- All commands are async but currently mostly stubs
- Resolved keybindings query should be O(1) from cached state (TODO)
VS CODE REFERENCE:
vs/workbench/services/keybinding/browser/keybindingService.ts- keybinding servicevs/platform/keybinding/common/keybindingResolver.ts- keybinding resolution algorithmvs/workbench/services/keybinding/common/keybinding.ts- keybinding data modelsvs/workbench/common/keybindings.ts- keybinding registry and conflict detection
TODO:
- Implement keybinding resolution with proper weighting (user > extension > default)
- Add keybinding conflict detection across all registered bindings
- Persist user keybinding overrides to ApplicationState
- Implement extension keybinding registration/unregistration
- Support keybinding context conditions (when clauses)
- Add command argument handling in keybindings
- Implement chord keybindings (multi-stroke sequences)
- Add keybinding export/import functionality
- Support platform-specific keybindings (Windows, macOS, Linux)
- Implement keybinding search and discovery UI
- Add keybinding documentation tooltips
- Support macro recording and playback via keybindings
MODULE CONTENTS:
- Tauri command functions (all
#[command] pub async fn):GetResolvedKeybinding- query final resolved keybindingsGetUserKeybindings- get user overrides (stub)RegisterExtensionKeybindings- register extension bindings (stub)UnregisterExtensionKeybindings- unregister extension bindings (stub)CheckKeybindingConflicts- detect conflicts (stub)