Setting up Japanese input method on LinuxPosted on Friday, 05 June 2020 Suggest An Edit
So I’ve been learning Japanese lately then I came across this question, “How do I input a japanese character on my laptop?” I use a 12-keys layout to insert japanese characters on my phone. It takes time to adapt but eventually I got comfortable enough with it.
At first, I tried to change the keyboard layout but it doesn’t work. I then came across this combination, Fcitx and Mozc. It’s been a great experience using them, it’s also very easy to set up and use.
According to Wikipedia, Fcitx is an input method framework with extension support for the X Window System that supports multiple input method engines.
It supports multiple input engines like
fcitx-hangul for Korean,
fcitx-mozc for Japanese,
fcitx-googlepinyin for Chinese, and more.
It also has a lot of addons that you can use like
clipboard for clipboard management,
spell for spellchecking, and many more.
Installing Fcitx is pretty simple. It’s available on most Linux distro official repository. I use Archlinux so mine will looks like this, you might use another distro but it’s basically the same.
# Arch $ sudo pacman -S fcitx # Debian / Ubuntu $ sudo apt-get install fcitx
After installing it, we need to set our input method variable to
To set our input method to
fcitx, we need to change our environment variable.
I set it on
~/.pam_environment, but you can set it on
~/.xinitrc or anything that gets sourced on login. Mine’s looks like this.
GTK_IM_MODULE DEFAULT=fcitx QT_IM_MODULE DEFAULT=fcitx XMODIFIERS DEFAULT=@im=fcitx SDL_IM_MODULE DEFAULT=fcitx IBUS_USE_PORTAL=1
You need to add
export if you put it on
According to the project home page itself, Mozc is a Japanese input method editor (IME) designed for multi-platform such as Android OS, Apple OS X, Chromium OS, GNU/Linux and Microsoft Windows. This OpenSource project originates from Google Japanese Input.
We need this for
fcitx that we’ve installed previously to be able to input Japanese characters.
We are using Fcitx as our input method framework so what we need to install is
fcitx-mozc. It’s also available on most Linux distro official repository.
# Archlinux $ sudo pacman -S fcitx-mozc # Debian / Ubuntu $ sudo apt-get install fcitx-mozc
After installing it, it will be available to Fcitx as an input method.
Now what we need to do is set Mozc as Fcitx input method. To do that, open up the
fcitx-configtool. It will roughly look like this, it may look different because of your theme.
+ sign on the bottom left corner. A pop-up will appear and make sure you uncheck the checkbox that says
Only Show Current Language, otherwise the
Mozc input method won’t show up.
After you uncheck the box, search for
Mozc then press OK. Here’s the end result.
After setting it all up, execute
fcitx on startup depending on your DE/WM. I put it in
~/.xprofile like so.
# ~/.xprofile fcitx &
If you put it on
~/.xprofile, it will get executed when you log in regardless of your DE/WM (this isn’t the case if you’re using a display manager like slim). After doing that, make sure you restart your DE/WM.
I now use SLIM which doesn’t execute
~/.xprofile, it executes
~/.xinitrc so I just move it there.
Fcitx is toggleable using a keybind that you can change from the
fcitx-confgitool which looks like this.
You can change the
Trigger Input Method to whatever key you like. I personally use
If you’ve done configuring it, try to activate it by pressing the keybind that you’ve defined before then try to type on something. It will look like this.
It looks like an autocomplete from a text editor. The way it works is if you write
romaji, it auto converts it to
hiragana which you can then press
TAB to scroll the options.
For example, if you write
watashi then it will show
わたし and if you continue pressing
TAB it will be the kanji form of it which is
私. This also applies to
If you don’t like the default light theme, you can change the appearance of it by changing the skin. Click the
fcitx icon on you systray, under the skin section, there should be 3 default theme. I personally use the dark one because I’m a big fan of dark mode.
You might want to install
fcitx-qt to be able to use it inside QT app. You might also need to add
~/.pam_environment to make it work inside Telegram Desktop. I didn’t need to add this when I was using KDE Plasma but I need to add it now because I use AwesomeWM.
All in all, I’m pretty satisfied with this setup. I don’t have to learn a new keyboard layout to insert Japanese characters. I can just write romaji and it will turn into hiragana, katakana, or kanji.
Anyway, thanks for reading this post. I hope you find this post useful and have a good day!