#input #mouse #keyboard

device_query

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

10 releases

Uses old Rust 2015

0.2.5 Aug 19, 2020
0.2.4 Apr 10, 2020
0.2.3 Feb 17, 2020
0.2.1 Jan 19, 2020
0.1.0 Apr 3, 2018

#81 in Hardware support

Download history 55/week @ 2020-07-07 38/week @ 2020-07-14 41/week @ 2020-07-21 62/week @ 2020-07-28 40/week @ 2020-08-04 168/week @ 2020-08-11 102/week @ 2020-08-18 111/week @ 2020-08-25 114/week @ 2020-09-01 88/week @ 2020-09-08 92/week @ 2020-09-15 78/week @ 2020-09-22 101/week @ 2020-09-29 97/week @ 2020-10-06 77/week @ 2020-10-13 107/week @ 2020-10-20

327 downloads per month
Used in less than 6 crates

MIT and maybe GPL-2.0-only

29KB
696 lines

device_query

Build Status

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

use device_query::{DeviceQuery, DeviceState, MouseState, Keycode};

let device_state = DeviceState::new();
let mouse: MouseState = device_state.get_mouse();
println!("Current Mouse Coordinates: {:?}", mouse.coords);
let keys: Vec<Keycode> = device_state.get_keys();
println!("Is A pressed? {}", keys.contains(Keycode::A));

Dependencies

Windows and macOS shouldn't require any special software to be installed for device_query to work properly. On Linux, the X11 development libraries are required for device_query to query state from the OS.

On Ubuntu/Debian:

sudo apt install libx11-dev

On Fedora/RHEL/CentOS:

sudo dnf install xorg-x11-server-devel

lib.rs:

A simple library for querying mouse and keyboard state without requiring an active window. Currently works in Windows, Linux, and macOS.

use device_query::{DeviceQuery, DeviceState, MouseState, Keycode};

let device_state = DeviceState::new();
let mouse: MouseState = device_state.get_mouse();
println!("Current Mouse Coordinates: {:?}", mouse.coords);
let keys: Vec<Keycode> = device_state.get_keys();
println!("Is A pressed? {}", keys.contains(&Keycode::A));

Dependencies

~140KB