Crates.io | windows-key-listener |
lib.rs | windows-key-listener |
version | 0.1.3 |
source | src |
created_at | 2024-09-16 22:13:36.19614 |
updated_at | 2024-09-16 22:15:43.520799 |
description | Listen to arbitrary key chords on Windows. |
homepage | |
repository | https://github.com/zmconnelly/windows-key-listener |
max_upload_size | |
id | 1376940 |
size | 21,984 |
A Rust library for global keyboard event listening and hotkey management on Windows.
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();
}
Add this to your Cargo.toml
:
[dependencies]
key_listener = "0.1.3"
Contributions are welcome! Please feel free to submit a Pull Request.