win-hotkeys 0.1.3

A simple thread safe rust library for system-wide hotkey management on Windows
Documentation

win-hotkeys

Crates.io License Documentation

A lightweight, thread-safe Rust library for managing system-wide hotkeys on Windows

The win-hotkeys crate simplifies working with the Windows API by abstracting and managing all interactions related to registering hotkeys and handling their events. Unlike many other solutions, this crate does not rely on the RegisterHotKey Windows function. Instead, it leverages a low-level keyboard hook to provide a more flexible and powerful way to monitor global hotkeys. This approach, allows for additional functionality (i.e. WIN key as modifier) and bypasses limitations of RegisterHotKey.


[dependencies]

win-hotkeys = "0.1.0"

Usage

use win_hotkeys::keys::{ModKey, VKey};
use win_hotkeys::HotkeyManager;

fn main() {
    let mut manager = HotkeyManager::new();

    manager.register_hotkey(VKey::A, &[ModKey::Ctrl], || {
        println!("Hotkey CTRL + A was pressed");
    }).unwrap();

    hkm.event_loop();
}

Examples

Up-to-date examples can always be found in the examples directory

License

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