YXL76 / keyboard_query

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:Rust 100.0%