| Crates.io | windows-key-listener |
| lib.rs | windows-key-listener |
| version | 0.2.0 |
| created_at | 2024-09-16 22:13:36.19614+00 |
| updated_at | 2025-03-16 18:47:35.029502+00 |
| description | Listen to arbitrary key chords on Windows. |
| homepage | |
| repository | https://github.com/zmconnelly/windows-key-listener |
| max_upload_size | |
| id | 1376940 |
| size | 37,462 |
A Rust library for global keyboard event listening and hotkey management on Windows.
use windows_key_listener::KeyListener;
use std::{sync::Arc, time::Duration};
fn main() {
let listener = KeyListener::new();
// Register shortcuts
key_listener.listen(
"Ctrl + Shift + A",
Duration::from_millis(200),
Arc::new(|| {
on_key_pressed();
false // Return true to block the event
})
);
run_your_app();
// When finished, clean up
key_listener.unlisten();
}
Add this to your Cargo.toml:
[dependencies]
windows-key-listener = "x.y.z"
Contributions are welcome! Please feel free to submit a Pull Request.