3

I just upgraded from Ubuntu 16.04 to 18.04 because of the Japanese (Mozc) Keyboard Layout problem and it persists in 18.04. Here is the problem described:

When using mozc to input Japanese, it's using the last selected keyboard layout to input romaji - can I fix which one it uses?

Below the answer is a comment that says I should install fcitx to get the "Configure Current Input Method" option. For that person it seems to have worked. But not for me.

In "Language Support" (Settings > Region & Language > Manage Installed Languages), I see under "Keyboard input method system" the following options: fcitx, IBus, XIM, none. Whichever option I choose I don't get the "Configure Current Input Method" option. And therefore I can't set the keyboard layout for Japanese (Mozc).

What am I doing wrong? I need to write Japanese and German, but writing Japanese and having a German keyboard layout pushed on me is really inconvenient.

My mozc.xml looks like this:

<component>
    <version>2.20.2673.102+dfsg-2</version>
    <name>com.google.IBus.Mozc</name>
    <license>New BSD</license>
    <exec>/usr/lib/ibus-mozc/ibus-engine-mozc --ibus</exec>
    <textdomain>ibus-mozc</textdomain>
    <author>Google Inc.</author>
    <homepage>https://github.com/google/mozc</homepage>
    <description>Mozc Component</description>
<engines>
<engine>
    <description>Mozc (Japanese Input Method)</description>
    <language>ja</language>
    <symbol>&#x3042;</symbol>
    <rank>80</rank>
    <icon_prop_key>InputMode</icon_prop_key>
    <icon>/usr/share/ibus-mozc/product_icon.png</icon>
    <setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
    <layout>default</layout>
    <name>mozc-jp</name>
    <longname>Mozc</longname>
</engine>

How should it look like at the end? Do the first two lines mean, I should make a backup copy? What do the @@ lines mean? And remove default and add jp? I'm trying to edit the file with gedit. Thank you very much for your help?

Bernhard
  • 53
  • 1
  • 6
  • I give up ... I installed "fcitx-mozc" twice and both times my OS froze and never recovered. Twice I reinstalled the whole OS. I use IBUS now and I have only two languages in the keyboard layout list: 1. Japanese, 2. Japanese (Mozc). Like this I can be sure, I will always have the Japanese keyboard layout. If I install the German layout, I get the problem with the interference Japanese (Mozc) with a German layout. And I have to use the compose key or the Ctrl + Shift + U thing to get my special German letters. If anyone has a solution for me, then please tell me. – Bernhard Apr 29 '18 at 15:07
  • Are you using KDE or Gnome? Why are you using IBUS? I have had more success with fcitx-mozc (in KDE, Gnome should come with an input method out of the box). However, concerning your question this might help: https://wiki.archlinux.org/index.php/IBus Scroll down to "Non US keyboards". – David Apr 29 '18 at 06:10
  • I use fcitx. I see a little keyboard symbol and a あ symbol on the right of it on the top right of the screen. Sometimes the small keyboard symbol turns into an orange あ symbol. I tried every tip I could find on the net, but it is getting worse, not better. At the moment I can't even right hiragana anymore, even if I choose it in the drop down menu. Sometimes I can only write hiragana. What I want is 1. Japanese (Mozc) and 2. German (QWERTY) as my languages. – Bernhard Apr 29 '18 at 06:57
  • I tried to add a third keyboard layout "English (US)" and the whole thing froze and I couldn't get in anymore. -> Total reinstall. Now I have only the keyboard layout for "Japanese" and that is exactly what I need, but of course I can't type hiragana and German special characters yet. What should I do? – Bernhard Apr 29 '18 at 09:01

2 Answers2

4

I think that David provided a useful hint. ibus-mozc does not seem to provide a GUI for controlling the keyboard layout used together with Mozc, but you can edit the file /usr/share/ibus/component/mozc.xml:

--- /usr/share/ibus/component/mozc.xml.orig
+++ /usr/share/ibus/component/mozc.xml
@@ -16,7 +16,7 @@
   <icon_prop_key>InputMode</icon_prop_key>
   <icon>/usr/share/ibus-mozc/product_icon.png</icon>
   <setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
-  <layout>default</layout>
+  <layout>jp</layout>
   <name>mozc-jp</name>
   <longname>Mozc</longname>
 </engine>

Or in plain English:

Replace the line

  <layout>default</layout>

with

  <layout>jp</layout>

With that change (and after a relogin), Japanese (Mozc) will always be based on the basic Japanese keyboard layout, irrespective of which keyboard layout you switched from when enabling Japanese (Mozc). Hence you can add e.g. the German layout without it affecting your use of Japanese (Mozc).

HTH

Gunnar Hjalmarsson
  • 32,938
  • 3
  • 63
  • 94
  • How should it look like at the end? Do the first two lines mean, I should make a backup copy? What do the @@ lines mean? And remove default and add jp? I'm trying to edit the file with gedit. Thank you very much for your help? – Bernhard Apr 29 '18 at 23:56
  • @Bernhard: Sorry about that; please see my edited answer. Yes, editing it using gedit is fine. (That's what I did when testing.) – Gunnar Hjalmarsson Apr 30 '18 at 00:03
  • Hi Gunnar, thank you very much. Right at this moment, it is working. 1. Japanese (Mozc) and 2. German (QWERTY). And when I change the languages, then the layouts are always right. – Bernhard Apr 30 '18 at 00:37
  • @Bernhard: I'm glad to hear that. :) – Gunnar Hjalmarsson Apr 30 '18 at 00:46
0

For me, using Ubuntu 22.04.1 LTS, the setting file was here:

$ sudo vim $HOME/.mozc/ibus_config.textproto

The text file was saying, if the file is not there, the file can be in either of these directories:

<!-- * $XDG_CONFIG_HOME/mozc/ibus_config.textproto -->
<!-- * $HOME/.config/mozc/ibus_config.textproto -->
<!-- * $HOME/.mozc/ibus_config.textproto -->
lechat
  • 101
  • 1
  • I have this problem in 22.04.2 LTS (Arm64). I have made the suggested edit. In my case the file is $HOME/.config/mozc/ibus_config.textpro. I've logged out and logged back in and even restarted. Still mozc is using the layout of the previously selected keyboard. I have a Japanese keyboard but non of the available layouts matches, except Japanese (Apple) but with that selected I can only input the kana on the key caps. Non of the English layouts match so many punctuation characters are wrong. Both Windows and macOS offer an Eng (Japanese) keyboard layout. How to get something similar in Ubuntu? – msc Mar 19 '23 at 11:48
  • The "Japanese" layout works. I didn't try it before because "Japanese (Macintosh)" did not work. For now I'm avoiding the mozc issue by reducing my keyboard list to just "Japanese" and "mozc". – msc Mar 19 '23 at 12:50