3

I need help setting up fcitx on my Kubuntu 15.04 to write in Japanese.

I first installed fcitx with apt.

I forgot the package names I installed over the experimentations, but here is what's currently installed on my system that starts with "fcitx":

fcitx                     fcitx-data                fcitx-googlepinyin:amd64  fcitx-modules             fcitx-ui-classic        
fcitx-anthy:amd64         fcitx-frontend-all        fcitx-libs-qt             fcitx-module-x11          fcitx-ui-light          
fcitx-bin                 fcitx-frontend-gtk2       fcitx-libs-qt5            fcitx-mozc:amd64          fcitx-ui-qimpanel       
fcitx-config-common       fcitx-frontend-gtk3       fcitx-module-dbus         fcitx-pinyin                                      
fcitx-config-gtk          fcitx-frontend-qt4        fcitx-module-kimpanel     fcitx-sunpinyin                                   
fcitx-config-gtk2         fcitx-frontend-qt5:amd64  fcitx-module-lua          fcitx-tools     

I then created the file /etc/X11/Xsession.d/95fcitx_start with:

export XMODIFIERS=@im=fcitx
export XIM=fcitx
export XIM_PROGRAM=fcitx

And then restart.

After logging in and launching manually fcitx in a console, the keyboard icon shows up in the taskbar, and I can open the "Configure Input Method" window from it to customize if necessary.

I put in the "Input Method" -> "Select Input Method" -> "Current Input Method" list:

  • Keyboard - French - French (Bepo, ergonomic, Dvorak…)
  • Mozc

So far, everything works. I can do Ctrl+Space to toggle the input methods, and it's fine.

Now, I want fcitx to start automatically when I logon. So I add fcitx at the end of the /etc/X11/Xsession.d/95fcitx_start file.

I logout and logon again…

Problem 1: I can use Ctrl+Space to toggle, but there is no keyboard icon in the system tray when fcitx is automatically started, so I cannot go in the options anymore and I have no visual indication whatsoever to tell me in which input method I am…

Problem 2: The popup that replaces kanas with kanjis appears in Firefox faaaaaar off the line in which I'm writing… near the bottom left corner of the window… That's strange.

Thank you for the help.

0

To input ctrl + space automatically after you login.

My idea to use xdotool (Actually this is not my idea, it was introduced how do we automatically set ibus-mozc when we login... in Japanese forum. I modified it to fit in fcitx-mozc)

sudo apt install xdotool

Then make a script ~/.im_sw.sh

#!/bin/bash
echo 'activation fcitx-mozc...'

sleep 1 && \
xdotool keydown ctrl && sleep 0.2 && \
xdotool key space && sleep 0.2 && \
xdotool keyup ctrl && \
for i in `seq 0 9`
do
  mozc=`ps -ef | grep 'fcitx-engine-mozc' | grep -v grep | grep -v srvchk | wc -l`
  if [ $mozc -gt 0 ]; then
    sleep 1
    xdotool keydown Zenkaku && sleep 0.2 && \
    xdotool keyup Zenkaku && sleep 0.2
    break
  else
    sleep 1
  fi
done
sleep 0.2 && \
xdotool keydown ctrl && sleep 0.2 && \
xdotool key space && sleep 0.2 && \
xdotool keyup ctrl

echo 'fcitx-mozc activation done.'

sleep 1

This script repeat pressing ctrl + space until fcitx got Zenkaku. So it's a little stupid when it is already Zenkaku mode and see it acts.

If you think it takes too long, make sleep time shorter.

chomod +x ~/.im_sw.sh

Next step

Make this script automatically run after login. create a startup script ~/.config/autostart/im_sw.desktop

[Desktop Entry]
Name=Input method switch
Comment=To Zenkaku Hiragana
Exec=$HOME/.im_sw.sh
Terminal=true
Type=Application
Hidden=false

I think this might work, and again this way I feel a little stupid I need to see a Terminal opens to do this.

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.