Japanese Input on Linux

So for any Linux user learning Japanese, you may or may not have had trouble getting a Japanese input method working depending on your setup. I am currently running KDE on Fedora 31 and I had trouble with this (turns out, KDE doesn't have ibus integration and fcitx isn't configured out of the box).

If you are on Gnome or XFCE, you should have no trouble with this as these have integration with ibus. I don't know about LXDE, MATE, or Cinnamon, but I did some searching and I didn't find all that many people having problems with these. However, that doesn't mean it has the integration. (If I am wrong, feel free to email me: aaron@planetaaron.net). However, I found a few Reddit threads asking about KDE. You can follow this if you are using a barebones window manager too such as OpenBox, i3, or bspwm. The process will be slightly different. I am going to assume if you are using these, you know how to configure them.

You could configure ibus if you would like but I personally found fcitx to be a bit nicer. However, when setting this up, I found The Arch Wiki Entry for fcitx was not particularly helpful. The main thing I noticed is that the file it wanted me to edit (~/.pam_environment), wan't actually sourced when KDE was loaded. I might have done something wrong (probably did knowing me) but adding a startup script for KDE worked without any issues for me.

So first off, you are going to want to install fcitx, and fcitx-kkc as well as the qt or gtk frontend.

sudo dnf install fcitx fcitx-kkc fcitx-qt5
sudo dnf install fcitx fcitx-kkc fcitx-gtk3

After this, you will need to set up environment variables for the session. In KDE, you can do this by putting this in ~/.config/plasma-workspace/env/input.sh

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

Yes, I will admit this is from the Arch Wiki....

After that, you need to autostart fcitx. You can do this by opening System Settings, going to startup and shutdown, selecting autostart, add program, and search for fcitx. after that, log out and log back in. You should now see a keyboard icon in the system tray. Right click on it, uncheck only show current language, and search for the input method called kana kanji. Now open up a text editor or anywhere you can type, set input method using the icon, and put it in Hiragana or Katakana mode.

You can switch any time you want by pressing ctrl+space. You can also set shift to start typing katakana if you would like. How you set it up is up to you.

I know this wasn't the best formatted tutorial, but I hope it helps someone. If you have trouble following this, email me (aaron@planetaaron.net) with what you got stuck on and I can try and make it more clear.

And remember, if COVID-19 is in your area, stay safe and don't go outside. It's not for you, it's for others.