nut.js
nut.js copied to clipboard
Creating square brackets
Version 2.1.1
Short overview Not able to create square brackets through "pressKey"-event and "type"-event.
Issue occurs on This issue occurred on the Windows operating system.
Replication
const { keyboard , Key} = require('@nut-tree/nut-js');
const ret = globalShortcut.register('Up', async () => {
await keyboard.type(Key.RightBracket)
// await keyboard.pressKey(Key.RightBracket) --> isn't working either
// await keyboard.releaseKey(Key.RightBracket) --> isn't working either
})
This issue is stale because it has been open for 30 days with no activity.
Hey @LenniM 👋
Could you please provide some additional context?
Which keyboard layout are you using? And does it generate any unexpected output instead?
Best regards
Simon
Hi @s1hofmann,
thanks for commenting!
Sure, I am trying to create a shortcut, triggering a specific action for a specific program (which is triggered through "]").
I am using a German keyboard layout (which could be the cause of the problem). When I use "keyboard.type(Key.RightBracket)" it returns a 9.
The typical way to create a "]" on a German keyboard is pressing right alt and 9. Thus, I have tried to create a bracket through using "keyboard.type(Key.Alt, Key.RightBracket)" - but that also generates a 9.
It doesn't return any error or any other unexpected output.
I hope this helps. If you have any further questions, then feel free to ask.
Best regards
Lenni