windows-key-listener

Crates.iowindows-key-listener
lib.rswindows-key-listener
version0.1.3
sourcesrc
created_at2024-09-16 22:13:36.19614
updated_at2024-09-16 22:15:43.520799
descriptionListen to arbitrary key chords on Windows.
homepage
repositoryhttps://github.com/zmconnelly/windows-key-listener
max_upload_size
id1376940
size21,984
Zach Connelly (zmconnelly)

documentation

README

Rust Key Listener

A Rust library for global keyboard event listening and hotkey management on Windows.

Features

  • Global keyboard event capture
  • Support for complex key chord combinations
  • Customizable callback execution on key events
  • Configurable event blocking and trigger intervals
  • Thread-safe design for concurrent operations

Usage

use std::time::Duration;
use std::sync::Arc;

fn main() {
    let listener = KeyListener::new();

    listener.listen(
        "Ctrl+Shift+A",
        true,
        Duration::from_millis(500),
        Arc::new(|| println!("Hotkey triggered!"))
    );

    // Keep the main thread alive
    std::thread::park();
}

Installation

Add this to your Cargo.toml:

[dependencies]
key_listener = "0.1.3"

Requirements

  • Windows OS
  • Rust 1.80+

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Commit count: 0

cargo fmt