Skip to content

Key Group

Julien Hartmann edited this page Feb 21, 2019 · 5 revisions

A key group is a set of named keys. They are used by most plugins to ease configuration.

Creating key groups

Global key groups

Global key groups are created by adding them to the groups dictionary, at the root of the configuration file. global key groups can be used anywhere in the configuration file. They consist of a single list of named keys. Here is an example:

groups:
    functions: [F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12]
    alpha: [a, b, c, d, e, f, g, h, i, j, k, l, m,
            n, o, p, q, r, s, t, u, v, w, x, y, z]
    arrows: [left, right, up, down]

This example defines three global key groups, with the expected keys.

Local key groups

It might be useful to define key groups to be used only within certain effects. For instance, imagine setting up key colors for a game, it can be useful to create a movement group, a spells group, and so on, without clobbering the global group list as other games might have their own movement group.

To do so, simply add a groups entry to an effect. Key groups defined there will have effect scope. In addition, if they have the same name as a global key group, they will take precedence.

Key group tips

  • Key names are resolved independently for each device.
  • Unknown key names are ignored with a warning in the log output. The assumption is the key in question could be intended for another device. This allows using the same group for several keyboards.
  • Valid key names can come either from the layout file of from the built-in list.
  • Starting the service debug output (keyledsd -vvv) will display all pressed keys, which might be useful when building one's configuration.

Advanced group definition

Starting from version 0.9, nested key group definitions are supported:

groups:
    letters:
        upper: [q, w, e, r, t, y, u, i, o, p]
        middle: [a, s, d, f, g, h, j, k, l]
        lower: [z, x, c, v, b, n, m]

This definition creates 4 groups:

  • upper, middle and lower with their listed keys.
  • letters, which contains all the keys listed in its nested groups.