wilix-team / iohook

Node.js global keyboard and mouse listener.
https://wilix-team.github.io/iohook
MIT License
1.19k stars 291 forks source link

Skipping keys when iohook is enabled on mac #229

Open aliarshad9691 opened 4 years ago

aliarshad9691 commented 4 years ago

I am using iohook in an electon app, its like an upwork tracker... I am listening to keyup event and when I start the tracker, my keys starts to skip... its very random and less intense.

Expected Behavior

When iohook is listing, I should be able to use the system normal. I should be able to type normal.

Current Behavior

When iohook is listening to keyup, my keys skip as I type.

Possible Solution

IDK

Steps to Reproduce (for bugs)

1) Start listing to keyup in an electron app. 2) start typing anywhere...

Context

It works find in linux and windows. only happen on mac. Have tested it on multiple macbooks.

Your Environment

abi: electron-76 "electron": "8.0.2", "iohook": "^0.6.5",

ToothpickFactory commented 4 years ago

I am having the same issue. It will catch the first key and then it will not catch any more.

josephjh commented 4 years ago

Similar issue here. Only allowing 1 key down event. (currently running MacOS Mojave 10.14.6)

var ioHook = require("iohook")

ioHook.on('keydown', function (event) {
    console.log(event.keycode)

});

ioHook.start();
nbouliol commented 4 years ago

Same issue in a Nodejs app

Code :

"use strict";

const ioHook = require("iohook");

ioHook.on("keyup", (e) => {
  console.log(e);
});

ioHook.start(true);

Output :

→ node index.js
hook_run [1121]: Accessibility API is enabled.
hook_run [1172]: CGEventTapCreate Successful.
hook_run [1178]: CFMachPortCreateRunLoopSource successful.
hook_run [1183]: CFRunLoopGetCurrent successful.
hook_run [1196]: CFRunLoopObserverCreate successful.
dispatch_event [108]: Dispatching event type 1.
hook_enable [257]: Thread Result: (0).
process_key_released [464]: Key 0X1C released. (0X24)
dispatch_event [108]: Dispatching event type 5.
{
  shiftKey: false,
  altKey: false,
  ctrlKey: false,
  metaKey: false,
  keycode: 28,
  rawcode: 36,
  type: 'keyup'
}
process_key_pressed [367]: Key 0X20 pressed. (0X2)
dispatch_event [108]: Dispatching event type 4.
process_key_pressed [379]: Using dispatch_sync_f for key typed events.
ddddddd
ash0x0 commented 3 years ago

Is this still an issue for anyone?

ganiskowicz commented 3 years ago

Just had this exact issue running macOS Big Sur 11.1

const ioHook = require('iohook');

ioHook.on("keydown",function(keyPress){
  console.log(`Keycode: ${keyPress.keycode}`)
});

ioHook.start();

Only output the key code once.

liuchengts commented 1 year ago

I'm also having the problem of only logging the first keystroke on a mac, has anyone solved it please? The very bad news is that I'm going to consider using jnativehook for java