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

Multiple Modifiers #2

Open
Younghart opened this issue Oct 5, 2019 · 1 comment
Open

Multiple Modifiers #2

Younghart opened this issue Oct 5, 2019 · 1 comment

Comments

@Younghart
Copy link

Hello,

I'd like to send multiple modifiers, with a key and also without. Is there a way to define two or three modifiers at the same time, with a single or multiple keycode(s)?

@julianschuler
Copy link
Owner

Sorry for the late answer (I wrongly assumed Github would send me a notification for new issues/PRs).

Yes, both is possible and supported. You can press send multiple modifiers at the same time by combining them with the bitwise or operator |.

Consider the following example:

// send CTRL+SHIFT+D
mKeyboard.sendKey(mKeyboard.asciiToKeycode('D'), MODIFIER_SHIFT | MODIFIER_CTRL);

Also have a look at examples/SendMultipleKeys on how to send up to 6 keycodes at the same time (also possible with multiple modifiers).

If you want to send just a modifier without another key, you have to specify the keycode of its button instead, e.g.:

// send left GUI
mKeyboard.sendKey(0xe0);

The keycodes for just sending modifier keys are the following:

left ctrl:    0xe0
left shift:   0xe1
left alt:     0xe2
left gui:     0xe3
right ctrl:   0xe4
right shift:  0xe5
right alt:    0xe6
right gui:    0xe7

Hope I could help you!

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

No branches or pull requests

2 participants