Experiencing the US Keyboard Layout on a Mac with a JIS Keyboard

mac
2015-09-02 21:56 (9 years ago) ytyng

When using a Mac with a JIS keyboard that I bought a long time ago, I can't help but notice the US keyboard enthusiasts around me. They often say, "For development, it's got to be a US keyboard!" Even when I try to explain, "Well, the Kana key and the Control key placement are better," I still feel a bit hurt inside. I'm sure you've experienced something similar.

Here's a simple way to try a US-style layout with a JIS keyboard.

Thanks to an amazing app called Karabiner (formerly known as KeyRemap4MacBook), it's easy to experiment.

  1. Download and install Karabiner from https://pqrs.org/osx/karabiner/index.
  2. Launch it from the Applications directory. Follow the instructions to allow "Karabiner_AXNotifier.app" in "System Preferences" → "Accessibility".
  3. In the Karabiner window, search for "japanese as us".

Check the option "Use Japanese Keyboard as US Keyboard".

That's it. You're done. From the moment you check it, the key layout will change to a US style. The backquote key is mapped to the ¥ key position.

http://ytyng.com/picture/mac/karabiner/karabiner1.png

Additionally, there's a similar mode called Semi-US Keyboard mode, where only the semicolon, colon, and quote keys are in the US style. Once you get used to it, it makes coding easier.

Enable one-touch underscore input with the "ro" key

The JIS keyboard has more keys than the US keyboard, so with "Use Japanese Keyboard as US Keyboard," there are some redundant keys.

The ¥ key and the underscore key on the JIS keyboard are both mapped to the backquote key, which feels a bit wasteful.

Although you can input an underscore by pressing "Shift" + "-", since there's a dedicated underscore key, and it's used frequently, let's set it up so that pressing that key inputs an underscore directly.

Click on Open private.xml in Karabiner and edit the private.xml file like this:

<?xml version="1.0"?>
<root>
  <item>
    <name>Use Japanese Keyboard as US Keyboard (without Underscore)</name>
    <identifier>remap.private_jis_jansi_without_underscore</identifier>
    <autogen>__SetKeyboardType__ KeyboardType::MACBOOK</autogen>
    <autogen>__KeyToKey__ KeyCode::JIS_YEN, KeyCode::BACKQUOTE</autogen>
    <autogen>__KeyToKey__ KeyCode::JIS_UNDERSCORE, KeyCode::MINUS, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT</autogen>
  </item>
</root>

The preset "Use Japanese Keyboard as US Keyboard" is written in Resources/include/checkbox/languages/japanese/keyboard_layouts.xml. By referring to that, we’re modifying it so that pressing the underscore key switches to "Shift" + "-".

After saving the private.xml, click the Reload XML button in the Change Key tab in Karabiner.

Then, the newly saved "Use Japanese Keyboard as US Keyboard (without Underscore)" will appear at the top. Check the checkbox to apply it.

Current rating: 5

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011