Kana input with Japanese 106/109 key keyboard in Ubuntu 18.04

I have a Japanese 108-key keyboard that I have been using for a long time on en-US Windows 7. It works correctly including keys that switch alpha/hiragana/katakana etc.

enter image description here

Recently I installed Ubuntu 18.04 as dual-boot on the same desktop and keyboard.

Japanese has been added in Language Support.

In Settings → Regions & Language → Input Sources, I added Japanese, and “Japanese” for the keyboard type (there is no 106/109 keyboard layout).

It seems to recognize this keyboard since it correctly matches some special character positions that are different from an en-US keyboard.

But keys for switching half-width/full width, hiragana/katakana etc. do nothing.

I checked some related questions but it seems to be an unanswered topic. Surely Ubuntu is used in Japan so I expect there is some solution or workaround.

I would like to learn the setup if anyone is successfully using such a keyboard. AFAIK, IME should be a separate matter. I have ibus and fcitx installed but maybe that’s a next step.


Solution 1:

Well I did some more research on this.

First, setup Japanese language support and install ibus. I would remove fcitx if it is there, as I read this might cause problems. I won't repeat these steps since they are well documented, but at this point you should see the following in Settings -> Region and Language: enter image description here

enter image description here

To get the keyboard switching, I found two additional steps are needed.

  1. Follow the steps on this page: Ubuntu で日本語キーボードレイアウト It's in Japanese, but the steps are easy to follow.

  2. Follow the instruction in the answer here: Japanese (Mozc) Wrong Keyboard Layout to modify mozc.xml.

mozc.xml can't be modified without root privileges, so it needs to be edited from the Terminal. In the directory containing mozc.xml, I used sudo nano mozc.xml

Then restart.

Open some text app., and now hankaku/zenkaku or katakana/hiragana keys switch function as expected. For kana, the IME works as expected.

Half width you should see:

enter image description here

Full width you should see this:

enter image description here