ui/keybindings/keybinding_resolver library
Classes
- ChordCancelledResult
- ChordMatchResult
- ChordNoMatchResult
- ChordResolveResult
- Result types for chord-aware resolution.
- ChordStartedResult
- ChordUnboundResult
- KeybindingBlock
- A block of keybindings for a specific context (JSON config format).
- KeybindingResolver
- Keybinding resolver — resolves keystrokes to actions with chord support, conflict detection, and context-aware binding lookup.
- KeybindingWarning
- A warning or error about a keybinding configuration issue.
- MatchResult
- NoMatchResult
- ReservedShortcut
- A shortcut that is reserved by the OS, terminal, or application.
- ResolveResult
- Result types for simple (no-chord) resolution.
- UnboundResult
Enums
- KeybindingWarningType
- Types of validation issues.
- ReservedSeverity
- Severity of a reserved shortcut warning.
Constants
-
contextDescriptions
→ const Map<
String, String> - Human-readable descriptions for each keybinding context.
-
macosReserved
→ const List<
ReservedShortcut> - macOS-specific shortcuts intercepted by the OS.
-
nonRebindable
→ const List<
ReservedShortcut> - Shortcuts that cannot be rebound — hardcoded in the application.
-
terminalReserved
→ const List<
ReservedShortcut> - Terminal control shortcuts intercepted by the terminal / OS.
-
validContextNames
→ const List<
String> - Valid context names for keybindings.
Functions
-
checkDuplicates(
List< KeybindingBlock> blocks) → List<KeybindingWarning> - Check for duplicate bindings within the same context.
-
checkReservedShortcuts(
List< ParsedBinding> bindings) → List<KeybindingWarning> - Check for reserved shortcuts that may not work.
-
chordExactlyMatches(
List< ParsedKeystroke> chord, ParsedBinding binding) → bool - Check if a full chord matches a binding's chord exactly.
-
chordPrefixMatches(
List< ParsedKeystroke> prefix, ParsedBinding binding) → bool - Check if a chord prefix matches the beginning of a binding's chord.
-
chordToDisplayString(
List< ParsedKeystroke> chord, {String platform = 'linux'}) → String - Convert a chord to a platform-appropriate display string.
-
chordToString(
List< ParsedKeystroke> chord) → String - Convert a chord to its canonical string representation.
-
filterReservedShortcuts(
List< KeybindingBlock> blocks) → List<KeybindingBlock> - Filter out reserved shortcuts that cannot be rebound.
-
formatWarning(
KeybindingWarning warning) → String - Format a warning for display.
-
formatWarnings(
List< KeybindingWarning> warnings) → String - Format multiple warnings for display.
-
getReservedShortcuts(
) → List< ReservedShortcut> - Returns all reserved shortcuts for the current platform.
-
keystrokesEqual(
ParsedKeystroke a, ParsedKeystroke b) → bool - Compare two ParsedKeystrokes for equality. Collapses alt/meta into one logical modifier — legacy terminals cannot distinguish them, so "alt+k" and "meta+k" are the same key. Super (cmd/win) is distinct — only arrives via kitty keyboard protocol.
-
keystrokeToDisplayString(
ParsedKeystroke ks, {String platform = 'linux'}) → String - Convert a ParsedKeystroke to a platform-appropriate display string.
-
keystrokeToString(
ParsedKeystroke ks) → String - Convert a ParsedKeystroke to its canonical string representation.
-
normalizeKeyForComparison(
String key) → String - Normalize a key string for comparison (lowercase, sorted modifiers). Chords (space-separated steps) are normalized per-step.
-
parseBindingBlocks(
List< KeybindingBlock> blocks) → List<ParsedBinding> - Parse keybinding blocks (from JSON config) into a flat list of ParsedBindings.
-
validateBindings(
List userBlocks, List< ParsedBinding> parsedBindings) → List<KeybindingWarning> - Run all validations and return combined, deduplicated warnings.
-
validateKeystroke(
String keystroke) → KeybindingWarning? - Validate a single keystroke string.
-
validateUserConfig(
List userBlocks) → List< KeybindingWarning> - Validate user keybinding config structure.