keyboard_query

Crates.iokeyboard_query
lib.rskeyboard_query
version0.1.0
sourcesrc
created_at2020-07-31 16:18:40.171529
updated_at2020-07-31 16:18:40.171529
descriptionA basic library for querying keyboard state on-demand without a window.
homepagehttps://github.com/YXL76/keyboard_query
repositoryhttps://github.com/YXL76/keyboard_query
max_upload_size
id271684
size10,316
兰陈昕 (YXL76)

documentation

README

keyboard_query

A simple library to query keyboard inputs on demand without a window. Will work in Windows, Linux on X11, and macOS.

Example

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;
    }
}

Dependencies

On Ubuntu/Debian:

sudo apt install libx11-dev

On Fedora/RHEL/CentOS:

sudo dnf install xorg-x11-server-devel
Commit count: 64

cargo fmt