npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tauri-plugin-user-input-api

v0.1.1

Published

Tauri plugin for user input monitoring and simulation (keyboard and mouse events)

Downloads

124

Readme

Tauri Plugin: User Input

Cross-platform Tauri v2 plugin for monitoring and simulating keyboard and mouse events.

Uses monio for event listening and key simulation, and enigo for text input, mouse buttons, mouse movement, and scroll.

Platform Support

| Platform | Monitoring | Simulation | |----------|-----------|------------| | macOS | Yes | Yes | | Windows | Yes | Yes | | Linux | Partial | Partial | | iOS | No | No | | Android | No | No |

macOS: Requires Accessibility permissions (System Settings > Privacy & Security > Accessibility).

Linux: X11 is supported. Wayland support is limited. See monio docs for details.

Installation

Rust

Add the plugin to your Tauri app's Cargo.toml:

[dependencies]
tauri-plugin-user-input = "0.1"

Register the plugin in your Tauri app:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_user_input::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

JavaScript

Install the npm package:

npm install tauri-plugin-user-input-api
# or
pnpm add tauri-plugin-user-input-api

Permissions

Add the plugin permissions to your app's capabilities file (src-tauri/capabilities/default.json):

{
  "permissions": [
    "core:default",
    "user-input:default"
  ]
}

JavaScript API

import {
  startListening,
  stopListening,
  setEventTypes,
  setWindowLabels,
  isListening,
  key,
  text,
  button,
  moveMouse,
  scroll,
} from "tauri-plugin-user-input-api";

Event Monitoring

Before listening, set which event types you want to receive:

import { setEventTypes, startListening, stopListening } from "tauri-plugin-user-input-api";

await setEventTypes(["KeyPress", "KeyRelease", "MouseMove", "ButtonPress", "Wheel"]);

await startListening((event) => {
  console.log("Event:", event.eventType, event);
});

// Later...
await stopListening();

Available event types: KeyPress, KeyRelease, ButtonPress, ButtonRelease, MouseMove, MouseDragged, Wheel.

Key Simulation

import { key } from "tauri-plugin-user-input-api";

// Press and release a key
await key("KeyClick", "KeyA");

// Hold a key
await key("KeyPress", "MetaLeft");
await key("KeyClick", "KeyC");
await key("KeyRelease", "MetaLeft");

// With delay before execution
await key("KeyClick", "Enter", { delayMs: 100 });

Key names follow the monio Key enum (e.g., KeyA, ShiftLeft, ControlLeft, MetaLeft, ArrowUp, Enter, Space, Backspace, F1-F24).

Text Input

import { text } from "tauri-plugin-user-input-api";

await text("Hello, world!");

Mouse Simulation

import { button, moveMouse, scroll } from "tauri-plugin-user-input-api";

// Move mouse (absolute or relative coordinates)
await moveMouse(500, 300, "Abs");
await moveMouse(10, -5, "Rel");

// Click a mouse button
await button("Clicked", "Left");
await button("Pressed", "Right");
await button("Released", "Right");

// Scroll
await scroll(3, "Vertical");
await scroll(-2, "Horizontal");

Button values: Left, Middle, Right, Back, Forward, ScrollUp, ScrollDown, ScrollLeft, ScrollRight.

Utility

// Check if currently listening
const listening = await isListening();

// Set which windows receive events via Tauri's emit system
await setWindowLabels(["main"]);

Rust API

Access the plugin API from Rust via the UserInputExt trait:

use tauri_plugin_user_input::UserInputExt;

// In a command or setup handler with access to AppHandle:
let user_input = app_handle.user_input();

// Key simulation
user_input.key(monio::Key::KeyA, tauri_plugin_user_input::EventType::KeyClick).unwrap();

// Text input
user_input.text("Hello from Rust!").unwrap();

// Mouse
user_input.move_mouse(100, 200, enigo::Coordinate::Abs).unwrap();
user_input.button(enigo::Button::Left, enigo::Direction::Click).unwrap();
user_input.scroll(3, enigo::Axis::Vertical).unwrap();

// Listening state
let is_active = user_input.is_listening();

Event Data

Events received in the startListening callback have this shape:

{
  eventType: "KeyPress" | "KeyRelease" | "ButtonPress" | "ButtonRelease" | "MouseMove" | "MouseDragged" | "Wheel",
  time: number,          // Unix timestamp in milliseconds
  key?: string,          // For key events (e.g., "KeyA", "ShiftLeft")
  button?: string,       // For button events ("Left", "Right", "Middle")
  position?: { x: number, y: number },           // For mouse move/drag events
  deltaPosition?: { deltaX: number, deltaY: number }  // For wheel events
}

License

MIT OR Apache-2.0