Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Windows Hotkeys
An opinionated, lightweight crate to handle system-wide hotkeys on windows
The windows-hotkeys crate abstracts and handles all interactions with the winapi, including
registering hotkeys and handling the events. A hotkey manager instance is used to register key
combinations together with easy callbacks.
Features
- Full highlevel abstraction over the winapi functions and events
- Easy to use
- Register hotkeys with Key + Modifier
- Register hotkeys with Key + Modifier and require additional keys to be pressed at the same time
- Set rust callback functions or closures that are executed on hotkey trigger
- High level rust abstractions over the Virtual Keys (
VK_*constants) and Modifier Keys (MOD_*constants) - Create
VKeys (Virtual Keys) andModKeys (Modifier Keys) from key name strings
How to use
- Create a
HotkeyManagerinstance - Register a hokey by specifying a
VKeyand one or moreModKeys, together with a callback - Run the event loop to react to the incomming hotkey triggers
use ;
use HotkeyManager;
Current limitations
Threading
Due to limitations in the windows API, hotkey events can only be received and unregistered on the
same thread as they were initially registered. This means that a HotkeyManager instance can't be
moved between threads.
Using windows-hotkeys with multithreading is still possible, but the HotkeyManager must be
created and used on the same thread.
A possible solution to this limitation might be to have each HotkeyManager run it's own thread in
the backgroud that is used to register, unregister and listen for hotkeys. This might be implemented
in the future and would provide a more ergonomic way to use the HotkeyManager in general.