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

@lysyyds/win32-mouse-keyboard-hook

v1.0.14

Published

An NPM library used for Electron to listen to keyboard and mouse events at the Windows system level

Readme

What's this for

An NPM library used for Electron to listen to keyboard and mouse events at the Windows system level

supported Electron verion:

  • "22.3.27", // 最后一个支持 Win7 的版本
  • "23.3.13",
  • "24.8.3",
  • "25.9.0",
  • "26.2.0",
  • "27.3.0",
  • "28.2.0",
  • "29.4.0",
  • "30.5.1",
  • "31.0.0",

Usage

install

npm i @lysyyds/win32-mouse-keyboard-hook

use

// import
const win32KeyboardHook = require("@lysyyds/win32-mouse-keyboard-hook");
// or
// import win32KeyboardHook from "@lysyyds/win32-mouse-keyboard-hook";

// import types
import type { Callback } from "@lysyyds/win32-mouse-keyboard-hook";

const callback: Callback = (type, eventType, x, y) => {
  const [type, eventType, x, y] = args;
  if (type === "key") {
    // keyboard event
    if (eventType == 1) {
      // keydown
      x; // keycode
    } else if (eventType == 2) {
      // keyup
      x; // keycode
    }
  } else if (type === "mouse") {
    x; // mouse position x
    y; // mouse position y

    if (eventType == 2) {
      // mouse left button down
    } else if (eventType == 3) {
      // mouse left button up
    } else if (eventType == 4) {
      // mouse right button down
    } else if (eventType == 5) {
      // mouse right button up
    } else if (eventType == 6) {
      // wheel active
    }
  }
};

win32KeyboardHook.start(callback);

types

declare module "@lysyyds/win32-mouse-keyboard-hook" {
  export type Callback = (
    type: "key" | "mouse",
    eventType: number,
    x: number,
    y: number,
  ) => void;

  export type CallbackArgs = Parameters<Callback>;

  export function start(callback: Callback): void;
  export function stop(): void;

  export enum KeyboardEventType {
    KeyDown = 1,
    KeyUp = 2,
  }

  export enum MouseEventType {
    Move = 1,
    LeftDown = 2,
    LeftUp = 3,
    RightDown = 4,
    RightUp = 5,
    Wheel = 6,
  }
}

Build yourself

Before starting, please configure the development environment: desktop development using C++/Windows 10/11 SDK/Python 3, and then run npm run build

**********************************************************************
** Visual Studio 2026 Developer Command Prompt v18.2.1
** Copyright (c) 2025 Microsoft Corporation
**********************************************************************
[DEBUG:ext\vcvars.bat] Found potential v145 version file: 'Microsoft.VCToolsVersion.VC.14.50.18.0.txt'
[DEBUG:ext\vcvars.bat] Testing v145 version file: 'Microsoft.VCToolsVersion.VC.14.50.18.0.txt'

C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools>D:

D:\>cd sourcecode

D:\sourcecode>cd win32-keyboard-hook

D:\sourcecode\win32-keyboard-hook>cl
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.50.35723 版
版权所有(C) Microsoft Corporation。保留所有权利。

用法: cl [ 选项... ] 文件名... [ /link 链接选项... ]

D:\sourcecode\win32-keyboard-hook>python --version
Python 3.14.2

D:\sourcecode\win32-keyboard-hook>npm i

D:\sourcecode\win32-keyboard-hook>npm run build-all