Skip to content

Raw Hotkeys #115

@johnny-smitherson

Description

@johnny-smitherson

Hello

I'm trying to achieve this example

use_hotkeys!(("controlleft") => move |_| {

Which is capturing when the Ctrl or Shift key pressed by itself (not a part of a combination like Ctrl+S).

But the callback for controlleft controlright does not trigger like suggested in the example above (never logs that text to console). Tested both ff and chrome

I see this switch

match part.to_lowercase().as_str() {

It seems the key is only pushed to the thing if it's not a modifier.
This means we cannot capture events if only key pressed is modifier.

Which means we can't implement tetris: Shift and C are to hold. Ctrl and Z are to rotate 90° counterclockwise


But, say the switch above is changed to put the Ctrl both in the key codes and in the modifiers. That means we might have to match it using Ctrl+ControlLeft instead of just ControlLeft.

But then, when you throw the Shift key into the controls, and the user is mashing the keys in a desperate manner, a Ctrl keydown followed by Shift keydown (before the Ctrl keyup) might be seen as Ctrl+Shift+LeftShift, which will not match Shift+LeftShift

tl;dr Do you foresee any option to treat modifier keys as normal keys (to avoid the complications above)? Maybe separate use_raw_hotkeys! that gives the key codes without pre-processing the modifiers

Metadata

Metadata

Labels

featureNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions