keyboard – Using Karabiner Elements how can I use the key pressed in from.any, in my to expression?

Spread the love


To start, if there is an active community for Karabiner discussions, I hope someone can point me at it. In the meantime, let me state the problem.


I have a USB foot switch which triggers both key down/up events on the physical down event, so the only way for me to make it usable is with Karabiner, to toggle a state when tapped.

For example, Say I want it to toggle on the Command key, how is that done?

The mechanism I'm using to set up the toggle works, just using a variable that I can conditionally set. Let's call it foot-switch-toggle-mode

When it's value is 1 all key_codes should be given a Command modifer…

        "conditions": [
                "name": "foot-swtich-toggle-mode",
                "type": "variable_if",
                "value": 1
        "from": {
            "any": "key_code",
            "modifiers": {
                "optional": [
        "to": [
                ?!? <= no idea!
        "type": "basic"

Author: Subham

Leave a Reply

Your email address will not be published. Required fields are marked *