8000 Multiple groups for one plugin definition · Issue #32 · keyleds/keyleds · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Multiple groups for one plugin definition #32

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

Open
jtyr opened this issue Feb 14, 2019 · 2 comments
Open

Multiple groups for one plugin definition #32

jtyr opened this issue Feb 14, 2019 · 2 comments

Comments

@jtyr
Copy link
jtyr commented Feb 14, 2019

It would be nice if we could specify multiple groups for which a plugin applies:

- plugin: breathe
  # Either string with single color or list with multiple colors could be defined
  group: [group1, group2]
  period: 5000
  color: 009090
@spectras
Copy link
Member

Indeed. Adding to my todo list.

@spectras
Copy link
Member
spectras commented Mar 3, 2019

I have been assessing the complexity of that feature, and it turns out providing this transparently would have, with the current design, a performance cost that outweighs the benefit of making configuration a bit easier.

May I suggest using nested groups and yaml anchors to define such groups? This kind of things should work:

groups:
    function:
        F1toF4: &F1F4 [F1, F2, F3, F4]
        F5toF8: [F5, F6, F7, F8]
        F9toF12: &F9F12 [F9, F10, F11, F12]
    sides:
        left: *F1F4
        right: *F9F12

It is also possible to limit such definitions to a single effect stack:

groups:
    F1toF4: &F1F4 [F1, F2, F3, F4]
    F5toF8: [F5, F6, F7, F8]
    F9toF12: &F9F12 [F9, F10, F11, F12]
effects:
    my-effect-stack:
        groups:
            sides: [left: *F1F4, right: *F9F12]
        plugins:
          - plugin: fill
            color: darkblue
          - plugin: breathe
            group: sides
            period: 5000
            color: 009090

Untested, but I have similar things in my own config. If it gives you trouble, that's a bug.

If you are interested in the technical details:

  • Keyleds engine does not include any effect. Effects are plugins, dynamically loaded at runtime.
  • Therefore, when it reads configuration, keyleds only recognizes the plugin: <name> line, the rest of plugin configuration is just put aside.
  • When the effect loads, the engine hands it its configuration.
  • The effect then interprets the content of its configuration.
  • The consequence of that design is that complexity in this part would have to be handled by plugins themselves. This would induce code duplication and probable inconsistencies from effect to effect, especially with 3rd party effects.

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

No branches or pull requests

2 participants
0