iohook
iohook copied to clipboard
Skipping keys when iohook is enabled on mac
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)
- Start listing to keyup in an electron app.
- 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",
I am having the same issue. It will catch the first key and then it will not catch any more.
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();
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
Is this still an issue for anyone?
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.
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