Japanese Layout on KDE
Since I’ve had to reinstall my desktop environment several times in the past couple of weeks, I had no access to a Japanese layout to type with. I’m writing this to document how I setup a custom fork of mozc with additional dictionaries, and integrating it into KDE along with a few env-vars, and keybindings
This post will only highlight the things you need to place or setup.
Keybinding Documentation
Control + `– Activates IME/Deactivates IME to Direct Input Mode. (Moving from i.e Hiragana or katakana input back to English)Contrl + Escape– Hiragana key emulation for Hiragana InputShift + Escape– Katakana key emulation for Katakana InputAlt + `– I use this for emulating Hankaku/Zenkaku and Hiragana/Katakana keys. Currently, mapped to the former.
The
Escapekey here mentioned is physically the Capslock key
Installing mozc
I use merge-ut-dictionaries which just builds mozc, and then later fcitx5-mozc.
You can also install ibus-mozc since it provides a PKGBUILD for that.
$ git clone --depth 1 https://github.com/utuhiro78/merge-ut-dictionaries.git$ cd merge-ut-dictionaries/src/merge- Edit
make.sh, I enable all of the dictionaries, as well generating the latest one as well. (Uncommenting) # pacman -S python-jaconv$ sh make.sh$ cd ../../PKGBUILD && cp ../src/merge/mozcdic-ut.txt ./$ python3 generate-mozc-archive.py(You may need to edit version number in this and PKGBUILD if it cannot find the release)$ makepkg -sip fcitx5-mozc-ut.PKGBUILD# pacman -S --asdeps fcitx5-gtk fcitx5-configtool
Keyd
Keyd is a keyboard daemon program that allows you to remap keys at a kernel level, bypassing X11/Wayland garbage, resulting in a quite portable setup.
/etc/keyd/default.conf
[ids]
*
[main]
# Switch capslock and escape
capslock = esc
esc = capslock
# Japanese stuff
control = layer(control)
leftalt = layer(alt)
shift = layer(shift)
[control]
capslock = hiragana
[shift]
capslock = katakana
[alt]
#` = katakanahiragana
` = zenkakuhankaku
Environment Variables (fish)
$HOME/.config/fish/conf.d/env.fish
# Input Method
set -gx GTK_IM_MODULE "fcitx"
set -gx QT_IM_MODULE "fcitx"
set -gx XMODIFIERS "@im=fcitx"
set -gx SDL_IM_MODULE "fcitx"
set -gx GLFW_IM_MODULE "fcitx"
Plasma Settings
- System Settings -> Virtual Keyboard -> Fcitx5
There is also Fcitx5 Wayland Launcher, as of writing it is experimental and did not work with discord. I could have setup discord (chromium) with wayland flags at launch for IMs but then I would have to do it for every other electron based app, and instead opted for the default thing.
- Sytem Settings -> Autostart -> Add New -> Fcitx 5
fcitx5-mozc Configuration
This is configuration for mozc specifically, so it applies to the ibus version as well if you install, just the way to access it would be different.
- System Settings -> Input Method.
- Shows Mozc in the list, click on Configure (Settings-like Icon)
- Then scroll, and click on Configuration Tool
- It should say MS-IME for Keymap Style, click on Customize
- Click on the
CommandTab to sort commands alphabetically - For
Activate IMECommand andDirect InputMode, ReplaceEisuwithCtrl+` - For
Deactivate IMECommand andPrecompositionMode, ReplaceHankaku/ZenkakuwithCtrl+` - Click OK and apply all settings.
Log out of Plasma and Log back in
お茶飲みたい〜
Amrit Handa | resume | rss feed | source