pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.59k stars 835 forks source link

fail to map `cmmand + option + arrow` to `option + arrow` #3889

Open XixianLiang opened 1 month ago

XixianLiang commented 1 month ago

In chrome. cmmand + option + arrow can navigate between tabs,and I want to map it to option + arrow. The following config is what I wrote for this function, but it doesn't work. What's wrong with this config?

{
    "description": "Map Command + Option + Arrow to Option + Arrow",
    "manipulators": [
        {
            "from": {
                "key_code": "left_arrow",
                "modifiers": {
                    "mandatory": [
                        "command",
                        "option"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "left_arrow",
                    "modifiers": [
                        "option"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "right_arrow",
                "modifiers": {
                    "mandatory": [
                        "command",
                        "option"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "right_arrow",
                    "modifiers": [
                        "option"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
}
tekezo commented 1 month ago

The rules change command+option+arrows. If you want to change option+arrows to switch tabs, you should swap “from” and “to” in the JSON.

XixianLiang commented 1 month ago

The rules change command+option+arrows. If you want to change option+arrows to switch tabs, you should swap “from” and “to” in the JSON.

I'm confused about the grammar. It always throws "json must be object".

image

Here's the config.

{
    "description": "Map Command + Option + Arrow to Option + Arrow",
    "manipulators": [
        {
            "to": {
                "key_code": "left_arrow",
                "modifiers": {
                    "mandatory": [
                        "command",
                        "option"
                    ]
                }
            },
            "from": 
                {
                    "key_code": "left_arrow",
                    "modifiers": [
                        "option"
                    ]
                }
            ,
            "type": "basic"
        },
        {
            "to": {
                "key_code": "right_arrow",
                "modifiers": {
                    "mandatory": [
                        "command",
                        "option"
                    ]
                }
            },
            "from": 
                {
                    "key_code": "right_arrow",
                    "modifiers": [
                        "option"
                    ]
                }
            ,
            "type": "basic"
        }
    ]
}
tekezo commented 1 month ago

Please try this json.

{
    "description": "Map Command + Option + Arrow to Option + Arrow",
    "manipulators": [
        {
            "from": {
                "key_code": "left_arrow",
                "modifiers": {
                    "mandatory": [
                        "option"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "left_arrow",
                    "modifiers": [
                        "command",
                        "option"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "right_arrow",
                "modifiers": {
                    "mandatory": [
                        "option"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "right_arrow",
                    "modifiers": [
                        "command",
                        "option"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
}
XixianLiang commented 1 month ago

Please try this json.

It works. Thank you very much. And what's wrong with my config?