Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tkomde/iohook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iohook is a global native keyboard and mouse listener for Node.js. This is a fork of https://github.com/wilix-team/iohook, which is abandoned and unmainntained.

Robolab (MechaKeys, the integrated typing environment) provide a modern CI pipeline for easy, fast, reliable, builds of iohook for modern versions of Node and Electron.

Notice! This fork aim to support newer versions of Node.js / Electron and ES Module. Windows and Linux works, macOS doesn't work properly(mouse OK, keyboard NG). Therefore, I do not provide prebuilt versions for macOS. hwanyong/iohook-macos is recommended for macOS.

Supported Versions

  • Versions 1.1.7 support Electron 29-39 and Node 20-24 (Excluding Electron 32 due to c++ error)
  • As of right now, i do not build 32-bit versions.
  • For older version support, use the wilix-team / robolab-io library
  • electron ABI versions

Installation

# Install iohook via npm
npm install --save @tkomde/iohook

By default, prebuilds will be downloaded for your own platform and architecture, but you can download specific ones through your package.json:

"iohook": {
    "targets": [
        "node-137",
        "electron-140"
    ],
    "platforms": [
        "win32",
        "linux"
    ],
    "arches": [
        "x64",
        "arm64"
    ]
}

Usage

CommonJS

const iohook = require('@tkomde/iohook');

iohook.on('keydown', event => {
    console.log(event);
});
iohook.start();

ES Modules / TypeScript

import { iohook } from '@tkomde/iohook';
# import iohook from '@tkomde/iohook'; # on bundler

iohook.on('mousedown', e => console.log(e));
iohook.start();

Both import styles provide the same singleton instance.

About

Global native keyboard and mouse listener for Node.js. Works node24 / electron38 / esm / arm-arch.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 79.7%
  • JavaScript 5.9%
  • M4 5.2%
  • C++ 4.1%
  • Roff 1.5%
  • CMake 1.5%
  • Other 2.1%