#hid #mouse #keyboard #windows

bin+lib hidmon

Lightweight, callback-based keyboard/mouse monitoring

2 releases

new 0.1.1 Feb 10, 2025
0.1.0 Feb 9, 2025

#1193 in Hardware support

36 downloads per month

Apache-2.0

13KB
161 lines

License: Apache 2.0

HIDMON

Simple library for monitoring HID (keyboard, mouse) events.

Supported Targets

  • Windows
    • Tested as working on Windows 11 Build 22631

Example Usage

See src/main.rs

Limitations

  • Windows

    • You MUST have a message loop running on the same thread as the HidMonitor hooks enabled by this function, otherwise your system may become unresponsive! For maximum safety, ensure the message loop is running before enabling any hooks, or shortly after. For applications which otherwise do not care about handling WinApi messages, HidMonitor::message_loop serves as a convenience function for starting a simple message handler.
    • Only one unique HidType can be monitored per running process. For example, attempting to start multiple HidMonitor's with HidType::Mouse will result in an error.
    • Read more about the implications of this function on the WinApi documentation for SetWindowsHookExA
  • Unix

    • TODO

TODO

  • Unix support
  • Unit testing
  • Support for multiple callbacks for a given HID type
  • Support for user data in callbacks

License

This project is licensed under the Apache License 2.0.
See the LICENSE file for details.

Dependencies

~124MB
~2M SLoC