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 repository is WIP: This fork aim to support newer versions of Node.js / Electron and ES Module. Windows works, MacOS doesn't work properly(mouse OK, keyboard NG), Linux works (raspberry pi 5). hwanyong/iohook-macos is recommended for macOS.
- Versions >= 1.1.2 support Electron 29-37 and Node 20-24 (Excluding Electron 32 due to c++ error)
- For older version support, use the wilix-team / robolab-io library
- electron ABI versions
# Install iohook via npm
npm install --save @tkomde/iohookBy default, prebuilds will be downloaded for your own platform and architecture, but you can download specific ones through your package.json:
"iohook": {
"targets": [
"node-108",
"electron-116"
],
"platforms": [
"win32",
"darwin",
"linux"
],
"arches": [
"x64",
]
}As of right now, we do not build 32-bit versions.
const iohook = require('@tkomde/iohook');
iohook.on('keydown', event => {
console.log(event);
});
iohook.start();import { iohook } from '@tkomde/iohook';
iohook.on('mousedown', e => console.log(e));
iohook.start();Both import styles provide the same singleton instance.