Giter Site home page Giter Site logo

tcrouch / device_query Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ostrosco/device_query

0.0 0.0 0.0 117 KB

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

License: MIT License

Rust 100.00%

device_query's Introduction

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

On newer versions of MacOS, you may run into issues where you only see meta keys such as shift, backspace, et cetera. This is due to a permission issue. To work around this:

  • open the MacOS system preferences
  • go to Security -> Privacy
  • scroll down to Accessibility and unlock it
  • add the app that is using device_query (such as your terminal) to the list

device_query's People

Contributors

ostrosco avatar macbrayne avatar notdanilo avatar tcrouch avatar orhun avatar dilawar avatar coderedart avatar powerory avatar lemunozm avatar tehmoros avatar segeljakt avatar horki avatar nycrat avatar chris--b avatar barkera avatar riizade avatar zeon256 avatar abdillah avatar sn99 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.