hookmap

Crates.iohookmap
lib.rshookmap
version0.5.1
sourcesrc
created_at2021-07-31 17:17:24.73657
updated_at2022-12-06 09:00:18.157813
descriptionRegisters hotkeys and simulates keyboard and mouse input.
homepage
repositoryhttps://github.com/keke1008/hookmap
max_upload_size
id429770
size64,357
(keke1008)

documentation

https://docs.rs/hookmap

README

hookmap

Crates.io API reference

Register hotkeys and simulate keyboard and mosue input.

Supported OS

  • Windows 10

Example

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();
}
Commit count: 496

cargo fmt