Giter Club home page Giter Club logo

inputbot's Introduction

InputBot docs link crates.io version

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

[dependencies]
inputbot = "0.6"
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:

[dependencies]
inputbot = { git = "https://github.com/obv-mikhail/InputBot", branch = "develop" }

Check out 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/<program name>.

Debian/Ubuntu based distros

  • libx11-dev
  • libxtst-dev
  • libudev-dev
  • libinput-dev

Examples

You can run the included examples by cloning the library and running cargo run --example <example name>. Similar to the note above, on Linux you have to run cargo build --examples && sudo ./target/debug/<example name>.

This is especially useful for testing the library when contributing.

inputbot's People

Contributors

obv-mikhail avatar redhawk18 avatar robertwayne avatar benediktwerner avatar furry avatar ocboogie avatar jewlexx avatar you-win avatar nycex avatar mbyx avatar positiveway avatar soniczentropy avatar bash-09 avatar fliegendewurst avatar niiightmarexd avatar red-lightning1 avatar viniciusth avatar zennii avatar adeyahya avatar bburdette avatar cactter avatar forbjok avatar frozolotl avatar im1x avatar kotatsuyaki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.