kbd 0.1.0

Pure-logic hotkey engine — key types, modifier tracking, binding matching, layer stacks, sequence resolution. No platform dependencies.
Documentation

kbd

crates.io docs.rs

Pure-logic hotkey engine — key types, modifier tracking, binding matching, layer stacks, sequence resolution. No platform dependencies.

[dependencies]
kbd = "0.1"
use kbd::action::Action;
use kbd::dispatcher::{Dispatcher, MatchResult};
use kbd::key::{Hotkey, Key};
use kbd::key_state::KeyTransition;

let mut dispatcher = Dispatcher::new();

let hotkey: Hotkey = "Ctrl+Shift+A".parse().unwrap();
dispatcher.register(hotkey.clone(), Action::Suppress).unwrap();

let result = dispatcher.process(&hotkey, KeyTransition::Press);
assert!(matches!(result, MatchResult::Matched { .. }));

Supports layers, introspection, and optional serde. See the API docs for the full picture.

License

kbd is licensed under the MIT license. See the LICENSE file for more information.