inputbot 0.3.1

A library for creating global hotkeys, and emulating inputs. Unlike AutoHotkey, InputBot handles hotkeys concurrently and supports both Windows and Linux.
Documentation

InputBot docs link crates.io version

A Rust library for creating global hotkeys, and emulating inputs. Unlike AutoHotkey, InputBot handles hotkeys concurrently and supports both Windows and Linux.

How-To

The code below demonstrates how to create some simple hotkeys.

extern crate inputbot;

use inputbot::*;
use KeybdKey::*;
use MouseButton::*;
use std::time::Duration;
use std::thread::sleep;

fn main() {
    // Autorun for videogames.
    NumLockKey.bind(|| {
        while NumLockKey.is_toggled() {
            LShiftKey.press();
            WKey.press();
            sleep(Duration::from_millis(50));
            WKey.release();
            LShiftKey.release();
        }
    });

    // Rapidfire for videogames.
    RightButton.bind(|| {
        while RightButton.is_pressed() {
            LeftButton.press();
            sleep(Duration::from_millis(50));
            LeftButton.release();
        }
    });

    // Mouse movement test.
    QKey.bind(|| MouseCursor.move_rel(10, 10));

    // Call this to start listening for bound inputs.
    handle_input_events();
}