Keyd not resolving aliases when binding chords
Aliases work wonderfully to add another layer of abstraction. I am currently using them to move my entire keyboard up one row without having to change my entire layout. Everything went great except with my cords. The deliniated valid key names are not behaving as mentioned in the documentation:
Note that
may itself be a valid key name, in which case all references to the key within the config file will be replaced with the new key. Additionally, if the assigned alias is a valid key name, the corresponding keycode will be assigned to the key by default. This makes it possible to redefine keys before any bindings are applied and is particularly useful in conjunction with the include mechanism to account for variations in hardware.
# moves keys up and to the right
[aliases]
1 = tab
q = capslock
a = leftshift
z =
2 = q
w = a
s = z
x =
[main]
capslock = leftcontrol # works as expected, q fuctions as control
a+q = up # does not shift with the reast of the key board keeping the a, q binding over the expected w, 2
a + z = down #
I may be missing something in the docu but can not seem to find anything mentioning this behavior. Is this working as designed or am i doing something wrong. I have alot of cords to manually change if I cant get this figured out.
Yep, from what it seems, chords/key combos (when put on the left of =) simply do not resolve aliases, which seems to include aliases that should resolve.
This is kind of indicated in keyd(1):
Chords are groups of keys which are treated as a unit when simultaneously depressed. A chord can be defined by using a group of + delimited key names as a left hand value. The corresponding action will be activated if all keys are struck within the chording interval (chord_timeout). This would imply that chords do not care about aliases and only read the keys according to the predefined mappings--i.e, irrespective of anything put in [aliases].
However, it is beyond me why chords would not support aliases, especially those to existing keys.
Whatever the case, you probably just have to manually replace the keys with what they alias to, as if you never set the aliases in the first place. For example, a+q = up to w+2 = up.
I have a similar problem. I wanted to do this:
leftcontrol=ctrl
rightcontrol=ctrl
[main]
ctrl+a=C-a # errors with 'ctrl is not a valid key'
ctrl+b=C-b # errors with 'ctrl is not a valid key'
...but it just fails. Which is why I would think that keyd just disregards your aliases when you make chords.
So the root cause, and potentially a better name for the issue, would probably be 'keyd does not resolve aliases when binding chords'
Whatever the case, though, yeah, that part of the documentation is wrong. Because not all references are getting replaced. Chords are an exception.
See #1061 for more info.
Thanks for the suggestion on the name, the redirect, & the explanation. Exactly what I was looking for. I'm going to try some workarounds; if any of them work, I'll add them here.
I'll keep the issue open until the documentation is updated, and then I'll submit a feature request.