Karabiner-elements: change Japanese keyboard to US(JIS to ANSI)

Created on 27 Sep 2016  路  13Comments  路  Source: pqrs-org/Karabiner-Elements

Can I use Karabiner-Elements to change my Apple Internal Keyboard type from JIS to ANSI.
Just like what I can do in Karabiner
image

Most helpful comment

In case anyone is not quite as satisfied with less than perfection... I did a full implementation of a complex modification to do the symbol remapping from Japan to US key layouts. This should behave exactly the same as if your Japanese keyboard was recognized as a US layout.

Just drop it in the "rules" block of the "complex_modifications" profile in ~/.config/karabiner/karabiner.json and you are good to go:

{
    "description": "Remap Japanese Keyboard to US",
    "manipulators": [
        {
            "from": {
                "key_code": "2",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "open_bracket"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "6",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "equal_sign"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "7",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "6",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "8",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "quote",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "9",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "8",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "0",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "9",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "hyphen",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "international1"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "equal_sign"
            },
            "to": [
                {
                    "key_code": "hyphen",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "equal_sign",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "semicolon",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "international3",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "grave_accent_and_tilde"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "open_bracket",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "close_bracket"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "close_bracket",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "non_us_pound"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "semicolon",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "quote"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "quote"
            },
            "to": [
                {
                    "key_code": "7",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "quote",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "2",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "non_us_pound"
            },
            "to": [
                {
                    "key_code": "international3",
                    "modifiers": [
                        "left_option"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "non_us_pound",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "international3",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
}

And then have fun reassigning the extra keys on your Japanese keyboard to do something cool... that is why I have one. ;)

All 13 comments

We discussed this earlier here https://github.com/tekezo/Karabiner-Elements/issues/88. I suggest you to go through it.

Currently there is no single click option.

@talha131 Thank you for your reply. But I think my problem is different with #88 .
My request is to change my Apple Internal Keyboard type from Japanese to US.
I can swap the cmd,option,control keys easily, but change the symbols like "#","@" is a huge project. Can you please help me? Thanks again.

Here is my current keyboard looks like:
image
And this is what I want it to look like:
image

To map " which is 鈬hift+2 in JIS to @, you are going to need #16.

Currently, if I map 2 to 3, it also maps @ to # (which are tied to 鈬hift+2 and 鈬hift+3). So basically you can remap key+shift_key to other key+shift_key.

To only map shift_key to other shift_key, you will have to wait for #16.

BTW, what happens when you set your keyboard to US in the system preferences? Can you share screenshot of onscreen keyboard with and without shift? I am just curious.

screen shot 2016-09-27 at 15 47 16

image
This is what my keyboard viewer shows.
In the past, I used karabiner to change my keyboard to US but it doesn't work right now on macOS Sierra.
image

If I have to remap keys one by one, I have to face the problem of map shift_keys only, which seems not supported right now?

Thanks a lot.
Can you please also share shot of keyboard with shift key pressed?

If I have to remap keys one by one, I have to face the problem of map shift_keys only, which seems not supported right now?

Yes

Can you please also share shot of keyboard with shift key pressed?

Sure.
image

Also ran into this situation.
So basically we just need to set __SetKeyboardType__ to JIS to US?
I don't have my Japanese one at hand. Has anyone done this yet?

Hi, in #55 there is a solution. And it works to me. Here is my setting. Hope it helps.
{ "profiles" : [ { "name" : "Default profile", "selected" : true, "fn_function_keys" : { "f12" : "volume_up", "f9" : "vk_consumer_next", "f5" : "vk_consumer_illumination_down", "f10" : "mute", "f1" : "vk_consumer_brightness_down", "f6" : "vk_consumer_illumination_up", "f2" : "vk_consumer_brightness_up", "f7" : "vk_consumer_previous", "f11" : "volume_down", "f3" : "vk_mission_control", "f8" : "vk_consumer_play", "f4" : "vk_launchpad" }, "simple_modifications" : { "japanese_eisuu" : "left_control", "japanese_kana" : "right_option", "international3" : "delete_forward", "international1" : "grave_accent_and_tilde" } } ] }
It works the same as the setting in Karabiner before.http://ml.cs.tsinghua.edu.cn/~yucen/static/karbiner_setting.png

Hey all!

I hate to dredge up an older thread, but I figure since this is a niche topic, I would get the attention of people that have tried this before.

I want to buy a Japanese keyboard as I like the smaller space bar. I am an English speaker and want to use Karabiner-Elements to map the Japanese layout to something like this:

jap-ansi

Note: Yellow key is extra after conversion!

Question

Looking at my image above, should I be able to modify @xinmei9322鈥檚 JSON to get the results I want?

I thought I would ask here before spending money on the keyboard.

For readability鈥檚 sake, here's the JSON @xinmei9322 posted:

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "fn_function_keys": {
                "f12": "volume_up",
                "f9": "vk_consumer_next",
                "f5": "vk_consumer_illumination_down",
                "f10": "mute",
                "f1": "vk_consumer_brightness_down",
                "f6": "vk_consumer_illumination_up",
                "f2": "vk_consumer_brightness_up",
                "f7": "vk_consumer_previous",
                "f11": "volume_down",
                "f3": "vk_mission_control",
                "f8": "vk_consumer_play",
                "f4": "vk_launchpad"
            },
            "simple_modifications": {
                "japanese_eisuu": "left_control",
                "japanese_kana": "right_option",
                "international3": "delete_forward",
                "international1": "grave_accent_and_tilde"
            }
        }
    ]
}

Got my Japanese keyboard today. I was able to get the mapping close to the image I posted previously.

Here's my ~/.config/karabiner/karabiner.json:

{
    "global": {
        "check_for_updates_on_startup": true,
        "show_in_menu_bar": true,
        "show_profile_name_in_menu_bar": false
    },
    "profiles": [
        {
            "devices": [],
            "fn_function_keys": {
                "f1": "display_brightness_decrement",
                "f10": "mute",
                "f11": "volume_decrement",
                "f12": "volume_increment",
                "f2": "display_brightness_increment",
                "f3": "mission_control",
                "f4": "launchpad",
                "f5": "illumination_decrement",
                "f6": "illumination_increment",
                "f7": "rewind",
                "f8": "play_or_pause",
                "f9": "fastforward"
            },
            "name": "Default profile",
            "selected": false,
            "simple_modifications": {},
            "virtual_hid_keyboard": {
                "caps_lock_delay_milliseconds": 0,
                "keyboard_type": "ansi"
            }
        },
        {
            "devices": [],
            "fn_function_keys": {
                "f1": "display_brightness_decrement",
                "f10": "mute",
                "f11": "volume_decrement",
                "f12": "volume_increment",
                "f2": "display_brightness_increment",
                "f3": "mission_control",
                "f4": "launchpad",
                "f5": "illumination_decrement",
                "f6": "illumination_increment",
                "f7": "rewind",
                "f8": "play_or_pause",
                "f9": "fastforward"
            },
            "name": "Japanese Keyboard",
            "selected": true,
            "simple_modifications": {
                "0": "9",
                "1": "grave_accent_and_tilde",
                "2": "1",
                "3": "2",
                "4": "3",
                "5": "4",
                "6": "5",
                "7": "6",
                "8": "7",
                "9": "8",
                "caps_lock": "fn",
                "delete_forward": "equal_sign",
                "equal_sign": "hyphen",
                "hyphen": "0",
                "international1": "backslash",
                "international3": "equal_sign"
            },
            "virtual_hid_keyboard": {
                "caps_lock_delay_milliseconds": 0,
                "keyboard_type": "ansi"
            }
        }
    ]
}

I would like to map one of the duplicate forward slash keys to a SHIFT + [ (to get a {) but it looks like this feature is not an option yet with KE.

Anyway, pretty satisfied. The Japanese keys can be mapped pretty close to US ANSI; there's a few changes, but nothing that I could not get used to in terms of muscle memory.

In case anyone is not quite as satisfied with less than perfection... I did a full implementation of a complex modification to do the symbol remapping from Japan to US key layouts. This should behave exactly the same as if your Japanese keyboard was recognized as a US layout.

Just drop it in the "rules" block of the "complex_modifications" profile in ~/.config/karabiner/karabiner.json and you are good to go:

{
    "description": "Remap Japanese Keyboard to US",
    "manipulators": [
        {
            "from": {
                "key_code": "2",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "open_bracket"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "6",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "equal_sign"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "7",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "6",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "8",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "quote",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "9",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "8",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "0",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "9",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "hyphen",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "international1"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "equal_sign"
            },
            "to": [
                {
                    "key_code": "hyphen",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "equal_sign",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "semicolon",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "international3",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "grave_accent_and_tilde"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "open_bracket",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "close_bracket"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "close_bracket",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "non_us_pound"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "semicolon",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "quote"
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "quote"
            },
            "to": [
                {
                    "key_code": "7",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "quote",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "2",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "non_us_pound"
            },
            "to": [
                {
                    "key_code": "international3",
                    "modifiers": [
                        "left_option"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "non_us_pound",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "international3",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
}

And then have fun reassigning the extra keys on your Japanese keyboard to do something cool... that is why I have one. ;)

mkdir -p ~/.config/karabiner/
touch ~/.config/karabiner/karabiner.json
open ~/.config/karabiner/karabiner.json

than you can copy the code from @steveonjava

Hi @steveonjava and @mhulse, just a disclaimer that my skill level here is novice at best.

I was able to "open ~/.config/karabiner/karabiner.json" and paste your code from above, but I have no clue what I'm doing. I thought I saved the file, but it after a minute it would disappear from the .json file. I must be doing something (or things) wrong but I can't seem to figure it out. Also, nothing seemed to change within the karibiner window either.

If anyone can offer any suggestions or guidance I would greatly appreciate it!

Was this page helpful?
0 / 5 - 0 ratings