iohook: key down do not capture keychar. reason?

here is what I got when capture event for keydown when I keydown on f

{"keycode":33,"rawcode":3,"type":"keydown"}

latest iohook MacOS High Sierra Node 8.9.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 29 (5 by maintainers)

Most upvoted comments

Just to get you moving @adamchenwei. If you’re hardstuck on this issue you can use String.fromCharCode() to get your desired keychar.

ioHook.on("keydown", e => {
  console.log(e.rawcode, String.fromCharCode(e.rawcode));
})

// Outputs something like:
// 69 "E"

This is of course just a low level solution since this doesn’t consider things like localization or lower-/uppercase. But I still hope this does fit your case… 😊

Sorry, I’m still learning my way around the code. I noticed that the mask value actually represents the modifier… 0x1 is shift. I’ll expose this in the event object.

@adamchenwei I’m working on that now. See #61 🎉

I’ll reopen #62 to be merged and recommend using keypress actual character (keypress will indicate if it is upper or lower case).

capture