#mouse #keyboard #automation #api-bindings

enigo

Cross-platform (Linux, Windows & macOS) library to simulate keyboard and mouse events

20 releases

0.2.0-rc2 Nov 18, 2023
0.1.2 Apr 3, 2023
0.1.1 Mar 30, 2023
0.0.14 Mar 7, 2020
0.0.7 Feb 5, 2017

#21 in Hardware support

Download history 886/week @ 2023-11-20 633/week @ 2023-11-27 759/week @ 2023-12-04 740/week @ 2023-12-11 862/week @ 2023-12-18 762/week @ 2023-12-25 654/week @ 2024-01-01 810/week @ 2024-01-08 803/week @ 2024-01-15 798/week @ 2024-01-22 782/week @ 2024-01-29 793/week @ 2024-02-05 966/week @ 2024-02-12 921/week @ 2024-02-19 997/week @ 2024-02-26 1338/week @ 2024-03-04

4,354 downloads per month
Used in 38 crates (31 directly)

MIT license

195KB
4.5K SLoC

Build status Docs Dependency status

Rust version Crates.io

enigo

Cross platform input simulation in Rust!

  • Linux (X11) mouse
  • Linux (X11) text
  • Linux (Wayland) mouse
  • Linux (Wayland) text
  • MacOS mouse
  • MacOS text
  • Win mouse
  • Win text
  • Serialize/Deserialize
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.

Runtime dependencies

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

apt-get install libxdo-dev

On Arch:

pacman -S xdotool

On Fedora:

dnf install libX11-devel libxdo-devel

On Gentoo:

emerge -a xdotool

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.

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.

Dependencies

~0–48MB
~702K SLoC