6

I'm running Ubuntu 18.04 on my PC, I use Mozc to input Japanese. Its default input mode is direct input(input English), I need to change it to hirakana everytime after restarting PC. Can I make hirakana to default?

3
  • Alternative choice of your desktop, unity, xfce, mate. # sudo apt install xubuntu-desktop/unity-desktop/mate-desktop. And install fcitx-mozc then the problem and many other problem are solved. Now, it seems too many bugs and mis-concepts are in gnomeshell 18.04. Jul 9 '18 at 23:48
  • @SadaharuWakisaka I don't think I will change the DE, another DE might solve this problem but they have theirs. I hope there is a solution in GNOME.
    – Ives
    Jul 10 '18 at 0:58
  • I tried my best to answer the original question, I hope it works. I am not sure this would work for the all of Ubuntu 18.04 LTS users. Jul 10 '18 at 7:39
2

Many Japanese users say that ibus-mozc has many bugs or uncomfortable features. So I think, until the bug-fix comes you can use other InputMethodEngine for a while.

sudo apt install fcitx-mozc

or

sudo apt install uim-mozc

After install open System preference > Language

IME

Please change this into your choice iBus/fcitx/uim and restart computer or your session.


If you are keen to stick on iBus and you can build Mozc from the source code with a handy Mozc support package Mozc UT. I omit how you download and extend source files.

$ vim src/mozc/src/unix/ibus/property_handler.cc

...
// Some users expect that Mozc is turned off by default on IBus 1.5.0 and later.
// https://code.google.com/p/mozc/issues/detail?id=201
// On IBus 1.4.x, IBus expects that an IME should always be turned on and
// IME on/off keys are handled by IBus itself rather than each IME.
#if IBUS_CHECK_VERSION(1, 5, 0)
const bool kActivatedOnLaunch = true; //false;
#else
const bool kActivatedOnLaunch = true;
#endif  // IBus>=1.5.0
...

Then build and install this. This information is provided from A wise programmer's blog "karelie" and Glasse-age


If this is too much work for you, there's an alternative. You can switch Composition Mode by the hotkey.

First activate the Mozc then, click on Mozc Icon on the menu bar.
Mozc Tool > Configuration Tools.

Menu

Like this.

Mozc Settings

The Mozc Settings Window should appear and click on the Customize button.

Keymap Window

When you click on the Command column, you can select actions for a hotkey, choose set input mode to Hiragana. Then you can assign your favourite hotkey, this example is for the Hiragana key that most of US keyboard layout doesn't have it. You may need to restart your computer after this setting.

Note: I think the window and the menu bar look different on 18.04 but it's essentially the same, in my opinion and I hope this helps or gives you a hint.

4
  • 2
    I set a shortcut to set input mode to Hiragana, but it doesn't work.
    – Ives
    Jul 11 '18 at 22:39
  • 1
    Please check (1) your new shortcut is NOT reserved for another global shortcut keys already (2) You need to switch Mozc first (3) You need to restart computer after the setting changes. Jul 11 '18 at 22:59
  • Also this related issues of bugs about shortcut doesn't set Hiragana input. github.com/google/mozc/issues/395 Jul 11 '18 at 23:08
  • 1
    Thanks, I did all of them, still not working. I think I need to compromise to this inconvenience.
    – Ives
    Jul 12 '18 at 1:11
1

solution 1: recompile mozc with hiragana

A discussion can be found in Is there a way to set hiragana as default? and Enhancement Request: making initial mode customizable for ibus-mozc:

Basically, you will need:

...is to replace const bool kActivatedOnLaunch = false; with const bool kActivatedOnLaunch = true; in src/unix/ibus/property_handler.cc then rebuild the ibus-mozc binary.

To rebuild ibus-mozc:

  1. Install the requirements to rebuild mozc
sudo apt install build-essential devscripts -y
sudo apt build-dep ibus-mozc -y
apt source ibus-mozc
  1. cd ~
  2. edit ./mozc*/src/unix/ibus/property_handler.cc, replacing:
    • before: const bool kActivatedOnLaunch = false;
    • after: const bool kActivatedOnLaunch = true;
  3. edit ./mozc*/src/protocol/commands.proto, replacing:
    • before:
      enum CompositionMode {
      DIRECT = 0;
      HIRAGANA = 1;
      
    • after:
      enum CompositionMode {
      DIRECT = 1;
      HIRAGANA = 0;
      
  4. building
    cd mozc*
    dpkg-buildpackage -us -uc -b
    
  5. install the new mozc build: sudo apt install ibus-mozc*.deb
  6. restart

solution 2: use the mozc default shortcuts to switch between japanese modes

The mozc's keys/shortcuts can be found from ibuz-mozc menu. You can read it from the ibus-mozc source-code too.

To access the ibus-mozc configurations:

  1. Click on Gnome Status menu (Gnome's top-left bar) > IBus icon menu (i.e. keyboard/input language selector) > Select Japanese Mozc input method.
  2. Again, click on Gnome Status Menu > IBuz > tools > Properties > Mozc Settings window.
  3. From Keymap style section > click on customize button (first one).

ibus-mozc configurations

So, the keys that binding the japanese mode switchers (i.e. hiragana, katakana, half-with etc) in a japanese JIS keyboard are bellow in table 1:

...
Composition Eisu    ToggleAlphanumericMode
Conversion  Eisu    ToggleAlphanumericMode
DirectInput Eisu    IMEOn
Precomposition  Eisu    ToggleAlphanumericMode
...
Composition Hankaku/Zenkaku IMEOff
Conversion  Hankaku/Zenkaku IMEOff
DirectInput Hankaku/Zenkaku IMEOn
Precomposition  Hankaku/Zenkaku IMEOff
...
Composition Muhenkan    SwitchKanaType
Conversion  Muhenkan    SwitchKanaType
Precomposition  Muhenkan    InputModeSwitchKanaType
...

And consider these keys too, in table 2. Mainly if you have a real non-japanese keybard. Look the Ctrl and F# switcher keys.

...
DirectInput F13 IMEOn
...
Composition Ctrl i  ConvertToFullKatakana
Conversion  Ctrl i  ConvertToFullKatakana
...
Composition Ctrl o  ConvertToHalfWidth
Conversion  Ctrl o  ConvertToHalfWidth
Composition Ctrl p  ConvertToFullAlphanumeric
Conversion  Ctrl p  ConvertToFullAlphanumeric
...
Composition Ctrl t  ConvertToHalfAlphanumeric
Conversion  Ctrl t  ConvertToHalfAlphanumeric
Composition Ctrl u  ConvertToHiragana
Conversion  Ctrl u  ConvertToHiragana
...
Composition F10 ConvertToHalfAlphanumeric
Conversion  F10 ConvertToHalfAlphanumeric
DirectInput F13 IMEOn
Composition F2  ConvertWithoutHistory
Composition F6  ConvertToHiragana
Conversion  F6  ConvertToHiragana
Composition F7  ConvertToFullKatakana
Conversion  F7  ConvertToFullKatakana
Composition F8  ConvertToHalfWidth
Conversion  F8  ConvertToHalfWidth
Composition F9  ConvertToFullAlphanumeric
Conversion  F9  ConvertToFullAlphanumeric
...
Composition Henkan  Convert
Conversion  Henkan  ConvertNext
DirectInput Henkan  Reconvert
Precomposition  Henkan  Reconvert
...
Composition Hiragana    InputModeHiragana
Conversion  Hiragana    InputModeHiragana
DirectInput Hiragana    IMEOn
Precomposition  Hiragana    InputModeHiragana
...
Composition Katakana    InputModeFullKatakana
Conversion  Katakana    InputModeFullKatakana
DirectInput Katakana    IMEOn
Precomposition  Katakana    InputModeFullKatakana
...
Composition Shift Muhenkan  ConvertToFullAlphanumeric
Conversion  Shift Muhenkan  ConvertToFullAlphanumeric
Precomposition  Shift Muhenkan  ToggleAlphanumericMode
...
Composition Kanji   IMEOff
Composition OFF IMEOff
Composition ON  IMEOn
Conversion  Kanji   IMEOff
Conversion  OFF IMEOff
Conversion  ON  IMEOn
DirectInput Kanji   IMEOn
DirectInput ON  IMEOn
Precomposition  ASCII   InsertCharacter
Precomposition  Kanji   IMEOff
Precomposition  OFF IMEOff
Precomposition  ON  IMEOn
...

solution 3: bind your own shortcut keys

From the solution 2, you can insert new entries on that table. The idea is replicate the table 1, but changing the key/shortcut combinations.

For example, my suggestions:

...
Composition Ctrl j  IMEOff
Conversion  Ctrl j  IMEOff
DirectInput Ctrl j  IMEOn
Precomposition  Ctrl j  IMEOff
Composition Ctrl b  SwitchKanaType
Conversion  Ctrl b  SwitchKanaType
Composition Ctrl y  ToggleAlphanumericMode
Conversion  Ctrl y  ToggleAlphanumericMode
DirectInput Ctrl y  IMEOn
Precomposition  Ctrl y  ToggleAlphanumericMode
...

If you are interested, you can read MOZC's romaji-hiragana conversion table too.

Solution 4: click on Ibus icon from Gnome

Click on Gnome Status Menu > IBus > Input Mode > select your desired input mode.

Japanese modes from ibus-mozc

Solution 1 resolves your question, and the others solutions are all the possible ways to switch (and to set hiragana).

1
  • Reviewed and updated, with detailed steps and screenshots. Thanks for your moderations @Nmath
    – paulolimac
    Jun 19 '20 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.