MCPcopy Index your code
hub / github.com/AltF02/mouse-rs

github.com/AltF02/mouse-rs @v0.4.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.2 ↗ · + Follow
47 symbols 83 edges 9 files 9 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Rust Docs Crates.io

Mouse-rs

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, windows and linux (X11)! If you need any other OS added please open an issue

Installation

Add mouse-rs to your cargo.toml

[dependencies]
mouse-rs = "0.4"

Example

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");
}

Usage

For more information please visit the docs

Linux disclaimer

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

Debian-based

sudo apt-get install -y libxdo-dev

Arch

sudo pacman -Sy xdotool

Fedora

sudo dnf install libX11-devel libxdo-devel

Gentoo

sudo emerge xdotool

Core symbols most depended-on inside this repo

into
called by 5
src/sys/macos.rs
press
called by 3
src/mouse.rs
release
called by 3
src/mouse.rs
win_translate_key
called by 3
src/sys/windows.rs
mouse_event
called by 3
src/sys/windows.rs
wheel
called by 2
src/mouse.rs
xdo_translate_key
called by 2
src/sys/linux.rs
get_position
called by 2
src/sys/macos.rs

Shape

Method 35
Class 5
Function 5
Enum 2

Languages

Rust100%

Modules by API surface

src/sys/macos.rs12 symbols
src/sys/windows.rs11 symbols
src/sys/linux.rs9 symbols
src/mouse.rs9 symbols
tests/main.rs3 symbols
src/types.rs2 symbols
src/types/keys.rs1 symbols

For agents

$ claude mcp add mouse-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact