Setting up an IME on Linux

The last time I set up a Chinese IME on Linux was on Ubuntu back in college days. I distinctly remember using the IBus framework. After installing that and one of the pinyin inputs, it just worked TM.

Now, on Endeavor OS, I thought I'd be adventurous and try another engine. After a lot of suffering in the Arch wiki, this table showed me my choices. IBus wasn't a choice, so fcitx5 is the only choice. (fcitx is deprecate in favor of fcitx5.) Then I thought, okay, Rime seemed intersting, let's use that.

fcitx5 is perfectly fine. It allows you to add a new keyboard layout. Except it only allows adding the keyboard layout. I added Rime but there was no way to configure it to actually use Chinese from this screen.

This was a painful lesson that input method editors (IMEs) are not the same as input method frameworks (IMFs, e.g. fcitx by itself)

Therefore, off I go to looking up how to configure Rime.

Choosing Rime might've been a robust, but very bad choice, for clueless people who don't understand how everything ties together. Arch's wiki entry on Rime is straightforward enough. Create a default.custom.yaml, and then put in the different input setups I wanted. The default luna_pinyin Rime came with switches between 4 or 5 of the different input schemas. I only need to switch between simplified pinyin and English, so I did what the wiki suggested and created a default.custom.yaml and pasted its example, changing terra_pinyin to pinyin_simp.

pinyin_simp for some reason did not work even though the files were clearly there, so I had to switch back to luna_pinyin, which did have a simplified option.

ez clap

Then came the real hard part. The IME itself is quite nice, though very different in appearance from Microsoft's Chinese IME and how I remembered IBus's IME to be. luna_pinyin, by default starts in Chinese mode, and every time I switched to a different text box, I needed to press Shift to switch back to English (what Rime calls "ascii_mode" under the hood even though the label is Latin Mode on fcitx). Definitely a dealbreaker. Next step is to figure out how to set default to English.

Unfortunately all of that was done last night so I no longer have screenshots of what it looked like before. All you have to know is that it was a struggle.

Since Arch wiki didn't say anything about ascii_mode, it was time to consult the Rime wiki!

Turns out Rime's repos and the main website are almost entirely in Chinese. Traditional Chinese, to make my eyes have an even worse time. Still, I had "Latin Mode" to start with. I had yet to learn that "ascii_mode" was what I wanted.

Adding "Latin Mode" to the schema list didn't work. That should've been a sign something else was going on, because it was there regardless of what schemas I added to the .yaml. Now I go to the rime issues page and search for "English."

Probably after what is definitely way too much time, I found references to "ascii_mode." I also stumbled upon the wiki guide on some different options. I see the below snippet and yep, that's the one.

So I add switches and the ascii_mode entry into my default.custom.yaml but it didn't work. The Rime engine didn't complain so it looked like it ignored the new configurations.

After a lot more stumbling, I found this page that explains how the switch works.

In other words, I should put reset to 1 and it should default to English.

Despite pasting in that new switches entry and making sure reset was 1, Rime still ignored it. The real solution took embarrassingly long for me to figure out. Accidentally pull an all-night kind of embarrassingly long.

After much headbanging and malding, the solution was to put the switches in a new custom.yaml prefixed with the schema name. In other words, luna_pinyin_simp.custom.yaml. I was trying to set it up in default.custom.yaml the whole time. I should have realized something was up, because all the files referencing ascii_mode were named [schema].custom.yaml. I should've known something was up. Too bad Arch wiki didn't say anything about these files, throwing me off track.

What the final working yaml looks like.

And now everything works and my user experience in Linux is much better.

The only struggle left is to change the input switch to something other than Shift. Every time I press Shift wanting to write something and then change my mind, Rime switches me into Chinese, and I have to wrestle with the Shift key to get it back to English.

Overall, what a great learning experience for setting up new software and reading Chinese documentation. I could've gone without the latter though, I wasn't intentionally signing up for this when I went with Rime.

EDIT: This was an even bigger struggle. This page sort of helped. The real MVP was this repo's default.yaml and key_bindings.yaml. Finally made me realize what I was doing wrong.

Learnings:

  • switcher and switch_key are entirely different things. switch_key is for using Caps Lock, eisu_toggle (some Japanese input thing), Control, and Shift to switch between inputs. The different options determine how text in the buffer is processed when switching to another input. switcher on the other hand, is for adding hotkeys that will bring up the little menu to manually set options for the switches (e.g. ascii_mode, full_shape, simplication etc.)
  • The keybinder/bindings will allow configuring different actions using different key combinations. This is where a custom toggle for ascii_mode can be set

My main blunder was thinking keybinder/bindings and switcher went hand in hand. Whatever key combination I put in keybinder/bindings, I assumed I also had to put in switcher. So of course, cue my extreme frustration that despite the default ascii_mode toggle working from the default.yaml configuration, the moment I added the same thing to both keybinder/bindings and switcher, of course the switcher menu came up instead of automatically toggling ascii_mode.

The final successful default.custom.yaml:

This took over 3 hours to headbang out, life sux

Edit 4/14: I am actually an utter idiot. I spent so much time malding over ascii_mode that I missed a spot check. The customizations worked for ascii_mode, but I never checked whether the simplication worked.

Here is the absolutely, definitely, finally correct .yaml setups, which I've verified. The scheme should be pinyin_simp, not luna_pinyin_simp.

Show Comments