Crates.io | keyboard_query |
lib.rs | keyboard_query |
version | 0.1.0 |
source | src |
created_at | 2020-07-31 16:18:40.171529 |
updated_at | 2020-07-31 16:18:40.171529 |
description | A basic library for querying keyboard state on-demand without a window. |
homepage | https://github.com/YXL76/keyboard_query |
repository | https://github.com/YXL76/keyboard_query |
max_upload_size | |
id | 271684 |
size | 10,316 |
A simple library to query keyboard inputs on demand without a window. Will work in Windows, Linux on X11, and macOS.
extern crate keyboard_query;
use keyboard_query::{DeviceQuery, DeviceState};
fn main() {
let device_state = DeviceState::new();
let mut prev_keys = vec![];
loop {
let keys = device_state.get_keys();
if keys != prev_keys {
println!("{:?}", keys);
}
prev_keys = keys;
}
}
On Ubuntu/Debian:
sudo apt install libx11-dev
On Fedora/RHEL/CentOS:
sudo dnf install xorg-x11-server-devel