7 stable releases
1.2.0 | Sep 4, 2021 |
---|---|
1.1.3 | Jun 6, 2021 |
1.1.2 | May 29, 2021 |
1.0.1 | May 29, 2021 |
#11 in #key-pressed
13KB
323 lines
About
This crate allows asking global (system-wide) key state (pressed or not) even when the app has no focus.
Windows and Linux supported.
Examples
use system_wide_key_state::*; // asking if Escape key is pressed right now let answer = is_key_pressed(KeyCode::KEsc); // asking if keyboard key T is pressed right now let answer = is_key_pressed(KeyCode::KT); // get key name assert_eq!("T", get_key_name(KeyCode::KT)); // convert text to keycode assert_eq!(string_to_key("T"), KeyCode::KT); assert_eq!(string_to_key("some invalid text"), KeyCode::None);
Dependencies
~1.6–2.2MB
~47K SLoC