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

Add a way to fire an Event without requiring a specific coordinate in a layout/Layers #101

Open
riskable opened this issue Oct 22, 2022 · 0 comments

Comments

@riskable
Copy link
Contributor

I've got an absolute rotary selection knob in my latest prototype and I want to fire a Keyberon Event when the user changes modes (i.e. rotates the knob to a different position). However, to do something like that I need to have said event defined somewhere inside of Layers with a matching coordinate. My absolute rotary encoder has nothing to do with the keyboard's normal layout but I still want to be able to send a keystroke to the PC when it changes (just an example).

Right now I've got some code that defines one set of Layers for each encoder position (all 8 of them!) and swaps them out whenever the user changes its position. I went to add CustomEvents for each mode and realized there's no way to actually fire off a Keyberon Event without having an associated coordinate in a pre-existing Layers/layout. I could just add yet another virtual row/column to the Layers (like I'm doing with the infrared remote stuff) but if I do that it means my Layers will grow from A columns/rows times B defined layers times 8 (number of encoder positions/modes) which is a lot of duplicated code inside of my layers.rs. It's getting out of hand already with everything duplicated 8 times (it's already over 5000 lines!).

It would be so much easier if I could do something like:

// This wouldn't be associated with any given row/column:
layout.new_virtual_event(CustomEvent::Whatever, k(A));
layout.virtual_event(CustomEvent::Whatever::Press());

...or provide a mechanism to attach arbitrary custom events like that to Layers when setting it up.

As a (really rough) alternative I could work around this if there were some way to use multiple Layers variables at once and combine them into a single keyboard report when needed.

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

1 participant