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

Key combinations #9

Open
Lange opened this Issue May 18, 2017 · 9 comments

Comments

Projects
None yet
3 participants
@Lange
Copy link
Owner

Lange commented May 18, 2017

Being able to register a callback for when an arbitrary combination of keys is pressed would be useful. Here's an example of what an API for this might look like (feedback welcome):

streamDeck.registerKeyCombo([4, 8, 11], () => {
    // do something when keys 4, 8, and 11 are all down at the same time
});

@Lange Lange added the enhancement label May 18, 2017

@Lange Lange added this to the v1.2.0 milestone May 19, 2017

@ProbablePrime

This comment has been minimized.

Copy link
Collaborator

ProbablePrime commented May 20, 2017

Woops accidental assignment

@ProbablePrime ProbablePrime modified the milestones: v1.2.0, v2.1.0 Jun 7, 2017

@Lange

This comment has been minimized.

Copy link
Owner Author

Lange commented Nov 28, 2017

I haven't thought of a better API for this, so I'd be okay with someone going ahead and implementing the API described in the original post and opening a pull request for it.

@Lange

This comment has been minimized.

Copy link
Owner Author

Lange commented Nov 28, 2017

Actually, maybe it should look like this:

const keyCombo = streamDeck.registerKeyCombo([4, 8, 11]); // returns an EventEmitter
keyCombo.on('down', keys => {
    console.log(keys); // => [4, 8, 11]
});
keyCombo.on('up', keys => {
    console.log(keys); // => [4, 8, 11]
});
keyCombo.unregister(); // Removes all listeners.

EDIT: We'd also want to memoize calls to registerKeyCombo.

@pkej

This comment has been minimized.

Copy link

pkej commented Mar 26, 2018

Would it be possible to include node-hid data? For example key 1 on stream deck plus keyboard data? Perhaps even seeing GUI on stream deck change with modifier keys?

@Lange

This comment has been minimized.

Copy link
Owner Author

Lange commented Mar 26, 2018

Oh interesting, you mean registering key combos which use some keys on the Stream Deck and some keys on a keyboard, in a single combo?

@pkej

This comment has been minimized.

Copy link

pkej commented Mar 26, 2018

Yes. But by leveraging https://github.com/agirorn/node-hid-stream and use the HidKeyboardPacket as an expanded return on event up and down, expanding on the current keyindex returned today. The HidKeyboardPacket can already return multiple key presses. I guess it could be expanded to include multiple keyindex values in the same way as keycodes. Node-hid-stream depends on node-hid so a good match.

@pkej

This comment has been minimized.

Copy link

pkej commented Mar 26, 2018

A further expansion would be to create a buffer for all the graphics on the keyboard and store these for “layers” that could be loaded on modifier key presses. So the stream deck will show one default layer initially, but for each layer applied to a modifier key combo it would change to show what the modifier would do. By stitching all the icons assigned to each physical key programmatically it would be pretty neat.

@Lange

This comment has been minimized.

Copy link
Owner Author

Lange commented Mar 27, 2018

I think for now, I don't want to include the ability to interact with other HID devices in this library. It seems like scope creep and would make this library harder to maintain.

On the topic of "layers", yes I agree that it'd be good for this library to expose some methods which assist users in implementing a multi-layered set of controls for their stream deck. I've not yet put any thought into what that API might look like. There's nothing stopping users from implementing this in their application code though, and doesn't necessarily require that we implement it in the library.

@pkej

This comment has been minimized.

Copy link

pkej commented Mar 27, 2018

I’ll be hacking tomorrow, after redeploying Windows and reinstalling node. I can see how feature creep would be bad. I’m thinking layers etc would probably be great as an GUI-config. I’ve got a lot of stuff lying around, x-keys, strategic commander, midi controllers, tactical keyboard, shuttle pro, ad nauseam, and also came across http://osc.ammd.net which is snappy on my iPad. So I think I need to model the different ways of layering for different devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment