#keyboard-input #keyboard #input #query #window #linux #macos

keyboard_query

A basic library for querying keyboard state on-demand without a window

1 unstable release

Uses old Rust 2015

0.1.0 Jul 31, 2020

#1869 in Hardware support

Download history 26/week @ 2024-07-22 26/week @ 2024-07-29 15/week @ 2024-08-05 30/week @ 2024-08-12 9/week @ 2024-08-19 7/week @ 2024-08-26 15/week @ 2024-09-02 19/week @ 2024-09-09 23/week @ 2024-09-16 37/week @ 2024-09-23 29/week @ 2024-09-30 26/week @ 2024-10-14 24/week @ 2024-10-21 25/week @ 2024-10-28 23/week @ 2024-11-04

98 downloads per month
Used in 2 crates

MIT license

7KB
133 lines

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

Dependencies

~135KB