package matrix
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/matrix.input/Input/Keymap/index.html
Module Input.KeymapSource
Key binding maps. See Keymap.
Key binding maps.
A keymap binds key and modifier combinations to values. Later bindings take precedence over earlier ones: add general bindings first, then more specific ones to override.
Modifier semantics
add leaves unspecified modifiers as wildcards (match any state), enabling prefix-free patterns like Ctrl+C without constraining Shift or Alt. add_char defaults all modifiers to false (exact match), so add_char 'c' only matches a plain c press with no modifiers active.
Note. Lock states (caps_lock, num_lock) are not matchable by keymaps since they represent toggle states rather than pressed modifiers.
Keymaps
The type for immutable keymaps binding keys to values of type 'a.
Adding bindings
val add :
?ctrl:bool ->
?alt:bool ->
?shift:bool ->
?super:bool ->
?hyper:bool ->
?meta:bool ->
'a t ->
Input__.Event.Key.t ->
'a ->
'a tadd map key data is map with a binding from key to data. Unspecified modifier arguments are wildcards (match any state). Later bindings take precedence.
Finding bindings
val find :
?event_type:(Input__.Event.Key.event_type -> bool) ->
'a t ->
Input__.Event.t ->
'a optionfind map event is the most recently added binding matching a Event.Key event with compatible modifiers, or None if event is not a key event or no binding matches.
event_type filters which key event types are eligible. It defaults to accepting Event.Key.Press and Event.Key.Repeat but rejecting Event.Key.Release, which prevents bindings from firing on key-up on terminals supporting the Kitty keyboard protocol. Pass ~event_type:(fun _ -> true) to match all event types.