Skip to content

expose keychar and forward EVENT_KEY_TYPED#60

Open
AucaCoyan wants to merge 1 commit intoSnosMe:masterfrom
AucaCoyan:add-keychar
Open

expose keychar and forward EVENT_KEY_TYPED#60
AucaCoyan wants to merge 1 commit intoSnosMe:masterfrom
AucaCoyan:add-keychar

Conversation

@AucaCoyan
Copy link
Copy Markdown

Hi! Hope you are doing well.

I'm using this library for my application, and when I realized I need to support other keyboards (AZERTY, or non-latin keyboards) I need to use the keychar value from keyboard_event_data , which uiohook.h exposes, but uiohook-napi doesn't.

The benefit of doing this is that with this PR you can:

  const letter = String.fromCharCode(event.keychar);

and have the rendered letter, instead of the keyboard position. This takes dead-key sequences in mind, so ´ + eé on Spanish/French layouts should work.

As a requirement for the dead key, I need to use EVENT_KEY_TYPED instead of _PRESSED and _RELEASED, because I want to grab the user intention to write é, not the combination of ´ + e pressed and released both.

I did this PR with some help of AI, but read everything I could and simplify as much as possible, I'm not familiar with the project, so sorry if I made a mistake.

Thank you for reading!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant