Make IBus-Mozc start in Hiragana rather than Direct input mode
Solution 1
-
You can modifying the source code and rebuild
sudo apt install build-essential devscripts -y sudo apt build-dep ibus-mozc -y apt source ibus-mozc
-
cd ~
then edit./mozc*/src/unix/ibus/property_handler.cc
and replace#if IBUS_CHECK_VERSION(1, 5, 0) const bool kActivatedOnLaunch = false;
with
#if IBUS_CHECK_VERSION(1, 5, 0)
const bool kActivatedOnLaunch = true;
or wrap the preprocessor directive condition with a logical NOT, to #if !(...)
(this is another method, choose one).
Now edit ./mozc*/src/protocol/commands.proto
, and replace
enum CompositionMode {
DIRECT = 0;
HIRAGANA = 1;
with
enum CompositionMode {
DIRECT = 1;
HIRAGANA = 0;
-
build it
cd mozc* dpkg-buildpackage -us -uc -b
-
sudo apt install ./ibus-mozc*.deb
(dfsg version) -
reboot
Solution 2
This is not an answer for the question but a work around for the problem.
If you have no problem to switch input method into fcitx
sudo apt install fcitx-mozc
Then it works almost the same as ibus-mozc and it remembers the choice of Hiragana/Katakana/Direct and etc.
[edit] inline conversion looks like
Solution 3
Briefly skimming over this link, I think the general gist is that this isn't going to get "fixed?"
Anyway, I have a workaround. (At least on kde and xfce4.)
- Run
ibus-pref
. - Go to Input Method, and hit the Preferences for Mozc.
- Click on Customize... for Keymap style.
- Hit Edit in the lower left corner and make a New Entry
- This new entry should be for "Direct Input" and the action should be Activate IME.
- As for the Key, be sure to pick something not frequently used by a lot of other applications.
- You can also add another entry for Deactivate IME.
Restart after this. Or maybe just logout is enough? I do know that I only noticed this working after I did a restart, though.
Related videos on Youtube
![Nicolas Raoul](https://i.stack.imgur.com/F5gLZ.png?s=256&g=1)
Nicolas Raoul
I am Nicolas Raoul, IT consultant in Tokyo. Feel free to copy/paste the source code from my StackExchange answers, I release it to the public domain.
Updated on September 18, 2022Comments
-
Nicolas Raoul almost 2 years
Every time I restart my computer and want to type in Japanese, pressing Super+Space is not enough, I also have to select Hiragana in Mozc's menu:
It gets me everytime. It is a bit like if your car's brake acted as an accelerator the first time you use it each day. Everyday the first time you brake you have to remember to push a lever. In other words: Incredibly annoying and a sure way to get accidents.
Apparently noone is motivated to fix the underlying problem, and there were talks that IBus would be replaced with Fcitx in 2015.10 (it did not).
Meanwhile, is there a quick way to fix this problem to avoid having to click that every time?
-
sugab about 8 yearsSame problem here after upgrade to 16.04. It works previously on 14.04.
-
computermacgyver almost 8 yearsNot a solution, but I edited the keyboard shortcuts so that I now press super+space and then use alt+` to switch to hiragana input. This is under Tools->Properties and then "Customize" the keyboard map.
-
user.dz over 7 years@computermacgyver that workaround could be a partial solution and it adds value to this topic. Could you post that as answer? Mention that it is just a workaround.
-
user.dz over 7 yearsLooks like same unresolved question here askubuntu.com/questions/561486
-
Nicolas Raoul over 7 years@user.dz: They are very similar indeed, but that question asks for a shortcut, while I ask for a way to just make it start that way.
-
-
Nicolas Raoul over 7 yearsCould you please detail how it works after you reboot? You just press the chosen key, and immediately you can start typing in Hiragana?
-
General Grievance over 7 yearsYou may still have to use the
super+space
to switch. The system tray should tell you which input method you're on. You can also tryqtconfig-qt4
, go to Interface > Default Input Method, switch to ibus (found it here). After you're on the Mozc Input, you should just be able to press your selected key. (e.g. I choseinsert
for both table entries) -
Nicolas Raoul over 7 yearsSo the procedure is the following, right? : 1) Log in. 2) Press
super+space
. 3) Press the chosen key. 4) Type in hiragana. It does not fix the problem but it saves a few seconds at each login. It does not save the time lost during the "start typing おはよう - realize that ohayou came out - remember about this bug" sequence though. -
Carolus about 4 yearsThanks. Worked for me on elementary OS 5.1.2 (based on 18.04 bionic) after installing some of the dependency debs that were also built in step 3. Also I needed to uncomment the first
deb-src
line (line 5) in/etc/apt/sources/list
for step 1. -
Carolus about 4 yearsIf you want your custom version of
ibus-mozc
not to be over-written by system-updates, you can increase the version number in the first line of./mozc*/debian/changelog
. I'm not knowledgeable of what I'm doing, so take my advice with some grains of salt. -
Carolus about 4 years
-
Sam Bull almost 4 yearsInstalling this made no difference to me, I'm not sure how to actually switch the method to fcitx.
-
Sadaharu Wakisaka almost 4 years
System settings > Language Support
select fcitx, thenSystem settings > Text Entry
choose Mozc (Fcitx), restart your computer. In my view @Lainnya 's answer is more practical. -
Sam Bull almost 4 yearsHmm, in Language Support, it is already set to fcitx. I can't find the "Text Entry" option though. Under "Language and Region" I can set the input source, but I only see a "Japanese (Mozc)" option, no Fcitx. If I uninstall ibus-mozc, then the Mozc option disappears. If it makes any difference, I'm running Ubuntu 20.04 with vanilla GNOME.
-
Sadaharu Wakisaka almost 4 yearsInstruction page ibus&fcitx here For me,
fcitx-mozc
is way better thanibus-mozc
I am a native Japanese speaker for nearly 50 years. If I were typing Japanese once per week, then I do not mindibus-mozc
or it is not set on Hiragana at start, since iBus v1.5 from Ubuntu 16.04 has had many minor bugs which often interferes my typing and it is really annoying/distracting. This is why I regret to use fcitx (since 10.04 ibus has been bright). You don't have to uninstall ibus, if you wantsudo apt purge ibus
-
rapstacke almost 4 years@SamBull Worked for me, I'm also on 20.04. Follow the "Instruction page ibus&fcitx" link above. Google translated page is well readable.
-
Sam Bull almost 4 yearsHmm, I think I've managed to switch it to fcitx, however the fcitx input methods is empty, there are no available input methods that I can add. Maybe there's another package I'm missing?
-
Sadaharu Wakisaka almost 4 years@SamBull, normally it works. There should be
mozc
in the input method menu after reboot. For some reasons you or something deleted some packages. Try delete a main package and install all the relative packages.sudo apt remove fcitx-mozc
andsudo apt install fcitx-mozc --install suggests --install recommends
-
Sam Bull almost 4 yearsOK, it wasn't showing anything, because fcitx wasn't actually running. To get it to run on startup, it seems that uninstalling ibus is the easiest option. For it to not look awful, I also needed to install
gnome-shell-extension-kimpanel
. It's still not perfect though, as the popup appears away from the cursor (maybe related to scaling in Wayland?), and won't work in the shell (e.g. when searching for an application), you also end up with a 2nd keyboard selector in the top panel that no longer works (unless removed with another extension). -
Sadaharu Wakisaka almost 4 years@SamBull, askubuntu.com/questions/567413/…
language-pack-ja
I edited my OP, it should look like that while typing. -
Sam Bull almost 4 yearsYep, it only looks like that after enabling
gnome-shell-extensions-kimpanel
. It's just the position that's wrong for me, which I suspect has something to do with Wayland (which is not the default for Ubunut) and/or HiDPI scaling. -
Sadaharu Wakisaka almost 4 years@SamBull, it might be a very helpful Q&A, please create a new question and describe your answer for someone has a same cruel time. By the sacred and dedicated Unix user mind, I guess you ought. Very much appreciated for your discovery.