| Crates.io | keyboard-chords |
| lib.rs | keyboard-chords |
| version | 0.1.1 |
| created_at | 2025-07-15 03:54:04.098723+00 |
| updated_at | 2025-08-04 22:14:35.549536+00 |
| description | A crate for windows input events |
| homepage | |
| repository | https://github.com/jmpnull/keyboard-chords |
| max_upload_size | |
| id | 1752514 |
| size | 38,058 |
keyboard-chords is a Rust library for simulating keyboard input events on Windows, with a focus on sending complex "chords" (combinations of key presses) in a simple and ergonomic way.
SendInput API)use keyboard_chords::Chord;
use std::time::Duration;
#[tokio::main]
async fn main() {
// Create a new chord
let mut chord = Chord::new();
// Pushing a string will append the required key presses
chord.push_str("Hello, world!");
// Emulate typing delay of 25 to 175ms per keypress
chord.typewriter(25..175);
// Wait some time before playing the keys back
chord.play_after(Duration::from_millis(500)).await;
}
Add to your Cargo.toml:
[dependencies]
keyboard-chords = "0.1.0"
tokio = { version = "1", features = ["full"] }
Chord::new(): Create a new chord.chord.push(press): Add a key press to the chord.chord.push_str("text"): Add key presses for each character in a string.chord.typewriter(range): Add random delays to each key press.chord.play().await: Play the chord immediately.chord.play_after(duration).await: Play the chord after a delay.See main.rs for some more example usage.
Currently, keyboard-chords supports Windows only, using the SendInput API via the windows crate.
This project is licensed under the MIT License. See LICENSE for details.
Contributions, issues, and feature requests are welcome! Please open an issue or submit a pull request on GitHub.