https://github.com/obv-mikhail/InputBot
Rust library for creating global hotkeys, and simulating inputs
https://github.com/obv-mikhail/InputBot
emulating-inputs global-hooks hotkeys keybinding keyboard-emulation mouse-emulation rust-library
Last synced: 7 days ago
JSON representation
Rust library for creating global hotkeys, and simulating inputs
- Host: GitHub
- URL: https://github.com/obv-mikhail/InputBot
- Owner: obv-mikhail
- License: mit
- Created: 2017-06-19T00:24:42.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2024-10-27T16:01:21.000Z (7 months ago)
- Last Synced: 2024-10-27T18:47:08.089Z (7 months ago)
- Topics: emulating-inputs, global-hooks, hotkeys, keybinding, keyboard-emulation, mouse-emulation, rust-library
- Language: Rust
- Homepage:
- Size: 215 KB
- Stars: 410
- Watchers: 7
- Forks: 74
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# InputBot [](https://docs.rs/inputbot) [](https://crates.io/crates/inputbot)
Cross-platform (Windows & Linux) library for simulating keyboard/mouse input events and registering global input device event handlers.Allows writing automation programs that collapse long action-sequences into single key-presses.
## Usage
```toml
[dependencies]
inputbot = "0.6"
``````rust
use inputbot::{KeySequence, KeybdKey::*, MouseButton::*};
use std::{thread::sleep, time::Duration};fn main() {
// Bind the number 1 key your keyboard to a function that types
// "Hello, world!" when pressed.
Numrow1Key.bind(|| KeySequence("Hello, world!").send());// Bind your caps lock key to a function that starts an autoclicker.
CapsLockKey.bind(move || {
while CapsLockKey.is_toggled() {
LeftButton.press();
LeftButton.release();sleep(Duration::from_millis(30));
}
});// Call this to start listening for bound inputs.
inputbot::handle_input_events(false);
}
```*NOTE: The README and examples are based off the `develop` branch of InputBot. If a feature is not working, you are probably using the version from crates.io. If you want to use the latest build, add this to your Cargo.toml:*
```toml
[dependencies]
inputbot = { git = "https://github.com/obv-mikhail/InputBot", branch = "develop" }
```Check out **[examples](/examples)** for comprehensive examples on how to use each feature.
## Build Dependencies
**Note:** libinput requires InputBot to be run with sudo on Linux - `sudo ./target/debug/`.### Debian/Ubuntu based distros
* **libx11-dev**
* **libxtst-dev**
* **libudev-dev**
* **libinput-dev**### [NixOs/Nix](flake.nix)
## Examples
You can run the included examples by cloning the library and running `cargo run --example `. Similar to the note above, on Linux you have to run `cargo build --examples && sudo ./target/debug/`.
This is especially useful for testing the library when contributing.