system_wide_key_state

Crates.iosystem_wide_key_state
lib.rssystem_wide_key_state
version1.2.0
sourcesrc
created_at2021-05-29 11:28:25.577379
updated_at2021-09-04 17:40:59.020342
descriptionQuery system-wide key state.
homepage
repositoryhttps://github.com/Flone-dnb/system-wide-key-state
max_upload_size
id403484
size13,136
Aleksandr Tretyakov (Flone-dnb)

documentation

https://docs.rs/system_wide_key_state

README

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);
Commit count: 21

cargo fmt