13 unstable releases (3 breaking)

0.4.1 Sep 24, 2020
0.4.0 Sep 24, 2020
0.3.2 Sep 22, 2020
0.2.2 Sep 20, 2020
0.1.4 Sep 19, 2020

#27 in Windows APIs

39 downloads per month

GPL-3.0 license

353 lines

Rust Docs Crates.io


Mouse-rs is a rust library for controlling your mouse from a rust program, without having to go into your kernel yourself.

This project was loosely based on the python mouse library. Currently it supports macos and windows, linux is on the roadmap


Add mouse-rs to your cargo.toml

mouse-rs = "0.4"


This is a simple example that moves your mouse to a position on screen and presses the left button.

use mouse_rs::{types::keys::Keys, Mouse};

fn move_and_press() {
    let mouse = Mouse::new();
    mouse.move_to(500, 500).expect("Unable to move mouse");
    mouse.press(&Keys::RIGHT).expect("Unable to press button");
    mouse.release(&Keys::RIGHT).expect("Unable to release button");


For more information please visit the docs

Linux disclaimer

If you're running into problems building on linux you need to install libxdo-dev.


sudo apt-get install libxdo-dev