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

linuxmouse

v1.0.0

Published

Enables you to create virtual mouse input on Linux using xdotool.

Readme

linuxmouse

A node.js module that does virtual mouse input on Ubuntu/Linux distros. A sibling module of macmouse. Implements the same functions, but works on X11 instead of Mac OS X Cocoa.

Dependencies

Uses the command line tool xdotool to manipulate the mouse, you need to install it with the following command:

$ sudo apt-get install xdotool

Installation

Install using npm,

$ npm install linuxmouse

Usage Example

var mouse = require('linuxmouse');

mouse.init();

var ptX = 800;
var ptY = 600;

var counter = 0;

var doThings = function() {
    mouse.Place(ptX, ptY);
    setTimeout(pressAndHold, 250);
}

var pressAndHold = function() {
    mouse.LeftButtonPress();
    setTimeout(doDragStuff, 250);
}

var doDragStuff = function() {
    ptX += 2;
    ptY += 2;
    mouse.DragPlace(ptX, ptY);
    if (counter < 15) {
        counter += 1;
        setTimeout(doDragStuff, 250);
    }
    else {
        mouse.LeftButtonRelease();
    }
}


doThings();

mouse.quit();

List of functions

And a small description for each function.

// Desc:   Imports the linuxmouse module as mouse
// Before: nothing
// After:  mouse is an uninitialized linuxmouse
var mouse = require('linuxmouse');

init

// Desc:   Initializes the linuxmouse module
// Before: mouse is an uninitialized linuxmouse
// After:  mouse is an initialized linuxmouse
mouse.init();

getRealPos

// Desc:   Sends request for real mouse position, more expensive than getPos
// Before: mouse is an initialized linuxmouse
// After:  pos holds x and y numbers representing the system mouse position
var pos = mouse.getRealPos();
var x = pos.x;
var y = pos.y;

getPos

// Desc:   Returns mouse position currently stored in the mouse module
// Before: mouse is an initialized linuxmouse
// After:  pos holds x and y numbers representing the system mouse position currently stored in the
//         mouse module
var pos = mouse.getPos();
var x = pos.x;
var y = pos.y;

Place

// Desc:   Sends mouse event message to place the system mouse at a specific position
// Before: mouse is an initialized linuxmouse, x and y are numbers representing a specific position
// After:  mouse event has been sent to move the system mouse to position defined by x and y
mouse.Place(x, y);

DragPlace

// Desc:   Sends mouse event message to place the system mouse at a specific position while in a 
//         dragging state
// Before: mouse is an initialized linuxmouse, x and y are numbers representing a specific position, the 
//         system mouse currently has (or thinks it has) the left mouse button pressed
// After:  mouse event has been sent to move the system mouse to position defined by x and y with left 
//         mouse button pressed
mouse.DragPlace(x, y);

Move

// Desc:   Sends mouse event message to move the system mouse (from current stored position in the mouse 
//         module) by a vector defined by dx and dy
// Before: mouse is an initialized linuxmouse, dx and dy are numbers representing our moving vector 
// After:  mouse event has been sent to move the system mouse by a vector defined by the numbers dx and dy
mouse.Move(dx, dy);

DragMove

// Desc:   Sends mouse event message to move the system mouse (from current stored position in the mouse 
//         module) by a vector defined by dx and dy while in a dragging state
// Before: mouse is an initialized linuxmouse, dx and dy are numbers representing our moving vector, the 
//         system mouse currently has (or thinks it has) the left mouse button pressed
// After:  mouse event has been sent to move the system mouse by a vector defined by the numbers dx and dy 
//         with left mouse button pressed
mouse.DragMove(dx, dy);

LeftButtonPress

// Desc:   Sends mouse event message to press and hold down the left button of the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to press and hold the left button on the system mouse
mouse.LeftButtonPress();

LeftButtonRelease

// Desc:   Sends mouse event message to release a pressed left button of the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to release a pressed left button on the system mouse
mouse.LeftButtonRelease();

Click

// Desc:   Sends mouse event message to press and release left button of the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to press and release left button on the system mouse
mouse.Click();

RightButtonPress

// Desc:   Sends mouse event message to press and hold down the right button of the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to press and hold the right button on the system mouse
mouse.RightButtonPress();

RightButtonRelease

// Desc:   Sends mouse event message to release a pressed right button of the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to release a pressed right button on the system mouse
mouse.RightButtonRelease();

RightClick

// Desc:   Sends mouse event message to press and release right button of the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to press and release right button on the system mouse
mouse.RightClick();

DoubleClick

// Desc:   Sends mouse event message to double click the system mouse
// Before: mouse is an initialized linuxmouse
// After:  mouse event has been sent to double click the system mouse
mouse.DoubleClick();

Scroll

// Desc:   Sends mouse scroll event message
// Before: mouse is an initialized linuxmouse, vertical and horizontal
//         are 'small signed integer values, typically in a range from -10 to +10',
//         in reality they can be any integer from -32768 to 32767,
//         if horizontal isn't provided it defaults to 0
// After:  scroll event has been sent to scroll by a vector defined by the
//         vertical and horizontal integers
mouse.Scroll(vertical);
mouse.Scroll(vertical, horizontal);

quit

// Desc:   Does garbage collection on some objective c stuff, be a good lad and call this when 
//         you're done using the linuxmouse module
// Before: mouse is an initialized linuxmouse
// After:  mouse is an uninitialized linuxmouse
mouse.quit();

License

(MIT License)