https://github.com/keke1008/hookmap
Registers hotkeys and simulates keyboard and mouse input.
https://github.com/keke1008/hookmap
rust
Last synced: over 1 year ago
JSON representation
Registers hotkeys and simulates keyboard and mouse input.
- Host: GitHub
- URL: https://github.com/keke1008/hookmap
- Owner: keke1008
- License: apache-2.0
- Created: 2021-06-27T14:13:33.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-07T13:30:01.000Z (about 3 years ago)
- Last Synced: 2025-02-08T02:09:14.662Z (over 1 year ago)
- Topics: rust
- Language: Rust
- Homepage:
- Size: 622 KB
- Stars: 16
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# hookmap
[](https://crates.io/crates/hookmap)
[](https://docs.rs/hookmap)
A rust library for Register hotkeys and emulate keyboard and mouse input.
## Supported OS
* Windows 10
## Example
```rust
use hookmap::prelude::*;
fn main() {
let mut hotkey = Hotkey::new();
// Remap H,J,K,L keys as in vim.
hotkey
.register(Context::default())
.remap(Button::H, Button::LeftArrow)
.remap(Button::J, Button::DownArrow)
.remap(Button::K, Button::UpArrow)
.remap(Button::L, Button::RightArrow);
// You can define hotkeys that work only when specific keys are pressed or released.
hotkey
.register(
Context::new()
.modifiers(buttons!(LCtrl, !RShift))
.native_event_operation(NativeEventOperation::Block),
)
.on_press(Button::Space, |_| {
seq!(with(LCtrl), A).send_ignore_modifiers();
})
.disable(buttons!(A, B))
.on_release(buttons!(A, B), |event: ButtonEvent| {
seq!(with(LShift), [event.target]).send_ignore_modifiers();
});
hotkey.install();
}
```