Cross platform input simulation. Node bindings for the enigo crate.
Enigo lets you simulate mouse and keyboard input-events as if they were made by the actual hardware. It is available on Linux (X11), macOS and Windows.
It can be used for testing user interfaces on different platforms, building remote control applications or just automating tasks for user interfaces unaccessible by a public API or scripting language.
This library is in an early alpha status, the API will change in in the future.
- 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
# npm
npm i @touchifyapp/enigo
# pnpm
pnpm add @touchifyapp/enigo
#yarn
yarn add @touchifyapp/enigoimport { Enigo, Button } from "@touchifyapp/enigo";
const enigo = Enigo.create();
// get mouse position
const [x, y] = enigo.getMousePosition();
// move mouse to position [100, 100];
enigo.mouseMove(100, 100);
//mouse operations
enigo.mouseDown("left");
enigo.mouseUp("left");
enigo.mouseClick("left");
//mouse operations
enigo.keyDown("alt");
enigo.keyUp("b");
enigo.keyPress("volumeup");import { Enigo, Button } from "@touchifyapp/enigo";
const enigo = Enigo.create();
// Paste
enigo.keyDown("control");
enigo.keyPress("v");
enigo.keyUp("control");
// Do things with the mouse
enigo.mouseMove(500, 200);
enigo.mouseDown(Button.Left);
enigo.mouseMove(600, 300);
enigo.mouseUp(Button.Left);
// Enter text
enigo.typeText("hello world");- Install the latest
Rust - Install
Node.js@20+which fully supportedNode-API - Run
corepack enable
# clone repository
git clone https://github.com/touchifyapp/node-enigo
cd node-enigos
# install packages
pnpm i
# build and test
pnpm build
pnpm testAfter pnpm build command, you can see enigo.[darwin|win32|linux].node file in project root.
This is the native addon built from lib.rs.
Run pnpm test to testing native addon.
Note: a build is necessary before running
pnpm testif changes were applied on the rust code.
With GitHub Actions, each commit and pull request will be built and tested automatically in [node@20, node@22, node@24] x [macOS, Linux, Windows] matrix.