I am looking for a way to change the fcitx input method using a terminal command. I know I can use the hotkeys, but for the purposes of an application I am writing, I need to use a command (something similar to ibus engine [name] for ibus). I've been looking through the fcitx documentation, but haven't found anything. Anyone know of a command? Thanks!


The appropriate command is fcitx-remote -s <imname>, where <imname> is of course the name fcitx uses to refer to the input method. Sadly, these names are not documented either, but you can find them in your fcitx configuration file (in my system, it's ~/.config/fcitx/profile), where there's a list of all the enabled (also, all disabled) input methods.

In particular, the names for xkb layouts go something like fcitx-keyboard-XYZ. For example fcitx-keyboard-us for the US English QWERTY layout, or fcitx-keyboard-de-dvorak for a German Dvorak layout. As another example, the Mozc Japanese IM is called simply mozc.

The current input method (the equivalent of ibus engine without parameters) can be obtained from the same file, in the line that says IMName=<imname>. Be aware, however, that the scope of this variable depends on whether you share the state between windows or not, and on whether fcitx is active (the result of running fcitx-remote).

  • 4
    fcitx-remote -t can also be used to toggle input methods, although it doesn't seem to work when bound from the i3wm config file for some reason – 0x6C38 Sep 4 '17 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.