I'm using Karabiner Elements 0.91.7 on macOS 10.12.5 on a MacBookPro13,3 (15" 2016 with touch bar).
Right now, I can define complex rules for keys and can define what modifiers can or must be pressed alongside. I'd like to turn this around and define rules for modifiers, no matter what key they are pressed with.
An example: I'd like to use the fn key and just prepend 'ctrl-b' to every key pressed while fn is held down.
Currently, I'd have to define rules for every key on the keyboard with the mandatory fn modifier. It would be more terse to just define one rule for the fn key and then being able to use a placeholder in the to definition to reference the key being pressed along with the modifier.
Something like:
"manipulators": {
"from": { "modifier": "fn" },
"to": [
{ "key_code": "b", "modifiers": ["left_control"] },
{ "key_code": "pressed_key_code" }
]
}
Another idea: specifying key_code (or better an additional mutually exclusive option key_codes) as an array of characters that should be mapped and then using a placeholder in the to definition.
I think, the new
"from": { "any": "key_code" }
could be used for what I said in my last comment, although I don't favour the syntax. IMHO, "key_code": "any" would have been much clearer. Anyway, this could solve part of it when we could have a virtual key referencing the pressed key (vk_any?) that could be used in the to or anywhere else in the manipulator definition.
see https://github.com/pqrs-org/KE-complex_modifications/blob/ef8074892e5fff8a4781a898869f8d341b5a815a/docs/json/personal_tekezo.json#L818-L844)
It would be awesome to open up the key_code value restrictions so that you could specify:
spacebar)h,j,k,l)any)and then have a virtual key (as stated above) to reference the pressed key.
+1
Simulating custom modifiers is one of my main use cases of KE.
But now, I am forced to repeat the same verbose mapping again and again for each key.
Working with the json file itself has become quite tedious since there's so much verbose repetition in there in my use case. I even started thinking about building a custom configuration tool, aka a script (most likely ruby) that contains my (simplified) configuration and some transformation code that can be used to generate karabiner.json. @tekezo Are there any plans on supporting wildcards with back references?
Hi, @thomasjachmann !!!
Working over the karabiner.json file is almost impossible for me. The way I personalize my keyboard using "Karabiner-Elements" is writing a lot of little Complex Modifications, organized each of the in several related manipulators. This way I can review a bunch of rules at a glance, making sure that the json file is well written because it appears in the "+Add Rule" list into Karabiner-Elements, just before adding them to the "karabiner.json" file. By now is the best way I Know.
Have a great day Thomas !!!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@tekezo Are there any plans on this or some kind of feature handling these requirements (flexible/wildcard mappings)?
There is not a plan to support the wildcard mappings now.
Using generator to achieve the wildcard mappings is the correct way.
Example: https://github.com/pqrs-org/KE-complex_modifications/blob/master/src/json/tmux_prefix.json.erb
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Working with the json file itself has become quite tedious since there's so much verbose repetition in there in my use case. I even started thinking about building a custom configuration tool, aka a script (most likely ruby) that contains my (simplified) configuration and some transformation code that can be used to generate
karabiner.json. @tekezo Are there any plans on supporting wildcards with back references?