Crates.io | system_wide_key_state |
lib.rs | system_wide_key_state |
version | 1.2.0 |
source | src |
created_at | 2021-05-29 11:28:25.577379 |
updated_at | 2021-09-04 17:40:59.020342 |
description | Query system-wide key state. |
homepage | |
repository | https://github.com/Flone-dnb/system-wide-key-state |
max_upload_size | |
id | 403484 |
size | 13,136 |
This crate allows asking global (system-wide) key state (pressed or not) even when the app has no focus.
Windows and Linux supported.
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);