keyflow 0.1.1

Cross-platform input simulation library for keyboard, mouse and hotkeys.
Documentation
use keyflow::prelude::*;
use std::thread;
use std::time::Duration;

fn main() -> Result<()> {
    // Example setup: Two 1920x1080 monitors
    // Primary (right): 0,0 to 1920,1080
    // Secondary (left): -1920,0 to 0,1080
    Keyflow::builder()
        .with_screen(Screen::new(-1920, 0, 3840, 1080))
        .initialize()?;

    thread::sleep(Duration::from_secs(2));

    // Move to primary center
    Keyflow::move_to(960, 540);
    thread::sleep(Duration::from_millis(1000));

    // Move to primary top-left
    Keyflow::move_to(0, 0);
    thread::sleep(Duration::from_millis(1000));

    // Move to primary top-right
    Keyflow::move_to(1920, 0);
    thread::sleep(Duration::from_millis(1000));

    // Move to primary bottom-right
    Keyflow::move_to(1920, 1080);
    thread::sleep(Duration::from_millis(1000));

    // Move to secondary top-left
    Keyflow::move_to(-1920, 0);
    thread::sleep(Duration::from_millis(1000));

    // Move across both monitors
    for x in (-1920..=1920).step_by(50) {
        Keyflow::move_to(x, 540);
        thread::sleep(Duration::from_millis(10));
    }

    // Move relative
    // Theoretically, X is now 0, but in practice this is unlikely due to OS mouse acceleration.
    Keyflow::move_by(-1920, 0);

    Ok(())
}