Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpad buttons don't work on Linux #360

Closed
1 of 3 tasks
suchipi opened this issue Jan 17, 2022 · 4 comments
Closed
1 of 3 tasks

Numpad buttons don't work on Linux #360

suchipi opened this issue Jan 17, 2022 · 4 comments
Labels
enhancement Enhancement to existing features libnut Root cause located in libnut
Milestone

Comments

@suchipi
Copy link

suchipi commented Jan 17, 2022

Version
2.0.0

Short overview
Calling keyboard.pressKey(nut.Key.NumPad1) doesn't work on Linux. It doesn't seem to work for any numpad key.

Issue occurs on

  • Virtual machine
  • Docker container
  • Dev/Host system

Detailed error description

If you run the following code in Node.js 12.22.7 on Linux Mint 20.3 Cinnamon 20.3,

const nut = require("@nut-tree/nut-js");

nut.keyboard.pressKey(nut.Key.NumPad1);

the result of the last line will be rejected with this error:

Error: Invalid key code specified.
    at /wherever/node_modules/@nut-tree/nut-js/dist/lib/provider/native/libnut-keyboard.class.js:22:28

Steps to reproduce error

  • Install Linux Mint Cinnamon 20.3
  • Install Node.js 12.22.7.
  • Create a file named test.js with the following content:
    const nut = require("@nut-tree/nut-js");
    
    nut.keyboard.pressKey(nut.Key.NumPad1);
  • Open a terminal emulator and use cd to navigate to the folder where said script (test.js) resides.
  • Type in node ./test.js

Expected behavior:

Numpad 1 gets pressed (virtually), so a "1" is typed into the terminal.

Actual behavior:

The key is not pressed, no "1" is typed into the terminal, and the following error is printed:

Error: Invalid key code specified.
    at /wherever/node_modules/@nut-tree/nut-js/dist/lib/provider/native/libnut-keyboard.class.js:22:28

Additional content

Please provide any (mandatory) additional data to reproduce the error (Dockerfiles etc.)

I am using a US keyboard layout, and my keyboard has a numpad. I also have a mouse attached that presents itself as both a mouse and a keyboard (because it has some macro keys on the side).

I am using Xorg, not wayland.

I have two monitors attached to my computer, and the primary monitor is on the right of the secondary monitor.

@s1hofmann s1hofmann added enhancement Enhancement to existing features libnut Root cause located in libnut labels Jan 17, 2022
@s1hofmann
Copy link
Member

Hi @suchipi 👋

Thanks for reaching out and the most thorough issue description I received so far 😄
I'll take a look at the missing keys and keep this issue updated.

s1hofmann added a commit to nut-tree/libnut-core that referenced this issue Jan 17, 2022
s1hofmann added a commit to nut-tree/libnut-core that referenced this issue Jan 17, 2022
s1hofmann added a commit to nut-tree/libnut-core that referenced this issue Jan 17, 2022
* (nut-tree/nut.js#360) Added keypad keys to Linux keymap

* (nut-tree/nut.js#360) Reverted accidental changes to Windows keymap
@s1hofmann s1hofmann added this to the TipTap milestone Jan 17, 2022
@s1hofmann
Copy link
Member

There's a new snapshot release of nut.js (npm i @nut-tree/nut-js@next) that includes numpad keys.

@suchipi
Copy link
Author

suchipi commented Jan 18, 2022

Oo awesome, thank you! I'll give it a shot

@suchipi
Copy link
Author

suchipi commented Jan 18, 2022

Works great; thank you so much!

@suchipi suchipi closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing features libnut Root cause located in libnut
Projects
None yet
Development

No branches or pull requests

2 participants