enigo-rs/enigo

Cross platform input simulation in Rust

Rust

1,798

816 commits

updated Oct 16, 2026

See the code

README

Build status Docs Dependency status

Rust version Crates.io

enigo

Cross platform input simulation in Rust!

  • Serialize/Deserialize
  • Linux (X11) mouse
  • Linux (X11) text
  • Linux (Wayland) mouse (Experimental)
  • Linux (Wayland) text (Experimental)
  • Linux (libei) mouse (Experimental)
  • Linux (libei) text (Experimental)
  • MacOS mouse
  • MacOS text
  • Windows mouse
  • Windows text

Enigo also works on *BSDs if they use X11 or Wayland. I don't have a machine to test it and there are no Github Action runners for it, so the BSD support is not explicitly listed.

let mut enigo = Enigo::new(&Settings::default()).unwrap();

enigo.move_mouse(500, 200, Abs).unwrap();
enigo.button(Button::Left, Click).unwrap();
enigo.text("Hello World! here is a lot of text  ❤️").unwrap();

For more, look at the (examples).

Features

By default, enigo currently works on Windows, macOS and Linux (X11). If you want to be able to serialize and deserialize commands for enigo (example), you need to activate the serde feature.

There are multiple ways how to simulate input on Linux and not all systems support everything. Enigo can also use wayland protocols and libei to simulate input but there are currently some bugs with it. That is why they are hidden behind feature flags.

On Windows, mouse coordinates and display size use physical pixels. Enigo temporarily switches the calling thread to per-monitor DPI awareness for those queries, so you do not need to change the process DPI awareness mode.

Runtime dependencies

Linux users may have to install libxdo-dev if they are using the xdo feature. For example, on Debian-based distros:

apt install libxdo-dev

On Arch:

pacman -S xdotool

On Fedora:

dnf install libX11-devel libxdo-devel

On Gentoo:

emerge -a xdotool

Permissions

Some platforms have security measures in place to prevent programs from entering keys or controlling the mouse. Have a look at the permissions documentation to see what you need to do to allow it.

Migrating from a previous version

Please have a look at our changelog to find out what you have to do, if you used a previous version.

Debugging

If you encounter an issue and want to debug it, turn on log messages as described here.

Testing this crate

Warning: The tests will move the mouse, enter text, press keys and open some applications. Read the test cases before you run them so you know what to expect. It's best to close everything so that the tests don't mess with your system. Some of them run for a long time because they are intended to be run in the CI. Make sure to run the tests sequentially, otherwise they will fail because other mouse movements or entered keys are detected. You can do so by running

cargo test --all-features -- --test-threads=1
automation
cross-platform
input
keyboard
mouse
rust
simulation

enigo-rs/enigo

Cross platform input simulation in Rust

Rust

1,798

816 commits

updated Oct 16, 2026

See the code

README

Build status Docs Dependency status

Rust version Crates.io

enigo

Cross platform input simulation in Rust!

  • Serialize/Deserialize
  • Linux (X11) mouse
  • Linux (X11) text
  • Linux (Wayland) mouse (Experimental)
  • Linux (Wayland) text (Experimental)
  • Linux (libei) mouse (Experimental)
  • Linux (libei) text (Experimental)
  • MacOS mouse
  • MacOS text
  • Windows mouse
  • Windows text

Enigo also works on *BSDs if they use X11 or Wayland. I don't have a machine to test it and there are no Github Action runners for it, so the BSD support is not explicitly listed.

let mut enigo = Enigo::new(&Settings::default()).unwrap();

enigo.move_mouse(500, 200, Abs).unwrap();
enigo.button(Button::Left, Click).unwrap();
enigo.text("Hello World! here is a lot of text  ❤️").unwrap();

For more, look at the (examples).

Features

By default, enigo currently works on Windows, macOS and Linux (X11). If you want to be able to serialize and deserialize commands for enigo (example), you need to activate the serde feature.

There are multiple ways how to simulate input on Linux and not all systems support everything. Enigo can also use wayland protocols and libei to simulate input but there are currently some bugs with it. That is why they are hidden behind feature flags.

On Windows, mouse coordinates and display size use physical pixels. Enigo temporarily switches the calling thread to per-monitor DPI awareness for those queries, so you do not need to change the process DPI awareness mode.

Runtime dependencies

Linux users may have to install libxdo-dev if they are using the xdo feature. For example, on Debian-based distros:

apt install libxdo-dev

On Arch:

pacman -S xdotool

On Fedora:

dnf install libX11-devel libxdo-devel

On Gentoo:

emerge -a xdotool

Permissions

Some platforms have security measures in place to prevent programs from entering keys or controlling the mouse. Have a look at the permissions documentation to see what you need to do to allow it.

Migrating from a previous version

Please have a look at our changelog to find out what you have to do, if you used a previous version.

Debugging

If you encounter an issue and want to debug it, turn on log messages as described here.

Testing this crate

Warning: The tests will move the mouse, enter text, press keys and open some applications. Read the test cases before you run them so you know what to expect. It's best to close everything so that the tests don't mess with your system. Some of them run for a long time because they are intended to be run in the CI. Make sure to run the tests sequentially, otherwise they will fail because other mouse movements or entered keys are detected. You can do so by running

cargo test --all-features -- --test-threads=1
automation
cross-platform
input
keyboard
mouse
rust
simulation

Project health

Overall

4.3/10

Maintained

10/10

Code review

2/10
OpenSSF Scorecard

crates.io

Latest release

0.6.1 · Aug 28, 2025

Releases this year

0

Significant stargazers

(top 24 of 57)

EGOIST

13,612 followers · starred Mar 2023

Guillaume Gomez

1,665 followers · starred Apr 2018

Richie Bendall

427 followers · starred Apr 2026

xu0o0

182 followers · starred Aug 2026