Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fcitx5 only works on default application, and cannot work on the third app #384

Closed
pplmx opened this issue Nov 16, 2021 · 24 comments
Closed

Comments

@pplmx
Copy link

pplmx commented Nov 16, 2021

Describe the bug
I cannot use fcitx5-pinyin on Chrome.

To Reproduce

  1. Typing on Chrome

Expected behavior
Works well on the Chrome.

Desktop (please complete the following information):

Additional context
Add any other context about the problem here.

@pplmx
Copy link
Author

pplmx commented Nov 16, 2021

System Info:

  1. uname -a:

    Linux Aurora 5.13.0-21-generic #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    
  2. lsb_release -a:

    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 21.10
    Release:	21.10
    Codename:	impish
    
  3. lsb_release -d:

    Description:	Ubuntu 21.10
    
  4. /etc/lsb-release:

    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=21.10
    DISTRIB_CODENAME=impish
    DISTRIB_DESCRIPTION="Ubuntu 21.10"
    
  5. /etc/os-release:

    PRETTY_NAME="Ubuntu 21.10"
    NAME="Ubuntu"
    VERSION_ID="21.10"
    VERSION="21.10 (Impish Indri)"
    VERSION_CODENAME=impish
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=impish
    
  6. Desktop Environment:

    Desktop environment is gnome3.

  7. Bash Version:

    BASH_VERSION='5.1.8(1)-release'
    

Environment:

  1. DISPLAY:

    DISPLAY=':0'
    
  2. Keyboard Layout:

    1. setxkbmap:

      xkb_keymap {
      	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
      	xkb_types     { include "complete"	};
      	xkb_compat    { include "complete"	};
      	xkb_symbols   { include "pc+cn(altgr-pinyin)+us:2+inet(evdev)"	};
      	xkb_geometry  { include "pc(pc105)"	};
      };
      
    2. xprop:

      _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "cn,us", "altgr-pinyin,", ""
      
  3. Locale:

    1. All locale:

      C
      C.UTF-8
      en_AG
      en_AG.utf8
      en_AU.utf8
      en_BW.utf8
      en_CA.utf8
      en_DK.utf8
      en_GB.utf8
      en_HK.utf8
      en_IE.utf8
      en_IL
      en_IL.utf8
      en_IN
      en_IN.utf8
      en_NG
      en_NG.utf8
      en_NZ.utf8
      en_PH.utf8
      en_SG.utf8
      en_US.utf8
      en_ZA.utf8
      en_ZM
      en_ZM.utf8
      en_ZW.utf8
      POSIX
      zh_CN.utf8
      zh_SG.utf8
      
    2. Current locale:

      LANG=en_US.UTF-8
      LANGUAGE=
      LC_CTYPE="en_US.UTF-8"
      LC_NUMERIC=zh_CN.UTF-8
      LC_TIME=zh_CN.UTF-8
      LC_COLLATE="en_US.UTF-8"
      LC_MONETARY=zh_CN.UTF-8
      LC_MESSAGES="en_US.UTF-8"
      LC_PAPER=zh_CN.UTF-8
      LC_NAME=zh_CN.UTF-8
      LC_ADDRESS=zh_CN.UTF-8
      LC_TELEPHONE=zh_CN.UTF-8
      LC_MEASUREMENT=zh_CN.UTF-8
      LC_IDENTIFICATION=zh_CN.UTF-8
      LC_ALL=
      
  4. Directories:

    1. Home:

      /home/mystic
      
    2. ${XDG_CONFIG_HOME}:

      Environment variable XDG_CONFIG_HOME is not set.

      Current value of XDG_CONFIG_HOME is ~/.config (/home/mystic/.config).

    3. Fcitx5 Settings Directory:

      Current fcitx5 settings directory is ~/.config/fcitx5 (/home/mystic/.config/fcitx5).

  5. Current user:

    The script is run as mystic (1000).

Fcitx State:

  1. executable:

    Found fcitx5 at /usr/bin/fcitx5.

  2. version:

    Fcitx version: 5.0.5

  3. process:

    Found 1 fcitx5 process:

      22531 fcitx5
    
  4. fcitx5-remote:

    fcitx5-remote works properly.

  5. DBus interface:

    Using dbus-send to check dbus.

    Owner of DBus name org.fcitx.Fcitx5 is :1.276.

    PID of DBus name org.fcitx.Fcitx5 owner is 22531.

Fcitx Configure UI:

  1. Config Tool Wrapper:

    Found fcitx5-configtool at /usr/bin/fcitx5-configtool.

  2. Config GUI for qt:

    Found fcitx5-config-qt at /usr/bin/fcitx5-config-qt.

  3. Config GUI for kde:

    kcmshell5 not found.

Frontends setup:

Xim:

  1. ${XMODIFIERS}:

    Environment variable XMODIFIERS is "@im=ibus" instead of "@im=fcitx". Please check if you have exported it incorrectly in any of your init files.

    Please set environment variable XMODIFIERS to "@im=fcitx" using the tool your distribution provides or add export XMODIFIERS=@im=fcitx to your ~/.xprofile. See Input Method Related Environment Variables: XMODIFIERS.
    If you are using gnome>=3.6, you may want to uninstall ibus or remove ibus-daemon in order to use any input method other than ibus. See Note for GNOME Later than 3.6 for more detail as well as alternative solutions.

    Xim Server Name from Environment variable is ibus.

  2. XIM_SERVERS on root window:

    Xim server name is the same with that set in the environment variable.

Qt:

  1. qt4 - ${QT4_IM_MODULE}:

    Environment variable QT_IM_MODULE is "ibus" instead of "fcitx". Please check if you have exported it incorrectly in any of your init files.
    You may have trouble using fcitx in qt4 programs.

    Please set environment variable QT_IM_MODULE to "fcitx" using the tool your distribution provides or add export QT_IM_MODULE=fcitx to your ~/.xprofile. See Input Method Related Environment Variables: QT_IM_MODULE.

  2. qt5 - ${QT_IM_MODULE}:

    Environment variable QT_IM_MODULE is "ibus" instead of "fcitx". Please check if you have exported it incorrectly in any of your init files.
    You may have trouble using fcitx in qt5 programs.

    Please set environment variable QT_IM_MODULE to "fcitx" using the tool your distribution provides or add export QT_IM_MODULE=fcitx to your ~/.xprofile. See Input Method Related Environment Variables: QT_IM_MODULE.

  3. Qt IM module files:

    Found fcitx5 qt5 module: /lib/x86_64-linux-gnu/fcitx5/qt5/libfcitx-quickphrase-editor5.so.
    Found fcitx5 im module for qt5: /lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so.
    Cannot find fcitx5 input method module for Qt4.

Gtk:

  1. gtk - ${GTK_IM_MODULE}:

    Please set environment variable GTK_IM_MODULE to "fcitx" using the tool your distribution provides or add export GTK_IM_MODULE=fcitx to your ~/.xprofile. See Input Method Related Environment Variables: GTK_IM_MODULE.

  2. gtk-query-immodules:

    1. gtk 2:

      Cannot find gtk-query-immodules for gtk 2

      Cannot find fcitx5 im module for gtk 2.

    2. gtk 3:

      Cannot find gtk-query-immodules for gtk 3

      Cannot find fcitx5 im module for gtk 3.

  3. Gtk IM module cache:

    1. gtk 2:

      Found immodules cache for gtk 2.24.33 at /lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache.
      Version Line:

      # Created by /usr/lib/x86_64-linux-gnu/libgtk2.0-0/gtk-query-immodules-2.0 from gtk+-2.24.33
      

      Failed to find fcitx5 in immodule cache at /lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache

      Cannot find fcitx5 im module for gtk 2 in cache.

    2. gtk 3:

      Found immodules cache for gtk 3.24.30 at /lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache.
      Version Line:

      # Created by /usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 from gtk+-3.24.30
      

      Found fcitx5 im modules for gtk 3.24.30.

      "/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
      "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      
    3. gtk 4:

      Found immodules cache for gtk 4 at /lib/x86_64-linux-gnu/gtk-4.0/4.0.0/immodules/giomodule.cache.
      Found fcitx5 im modules for gtk 4.

      libim-fcitx5.so: gtk-im-module
      
  4. Gtk IM module files:

    1. gtk 2:

      All found Gtk 2 immodule files exist.

    2. gtk 3:

      All found Gtk 3 immodule files exist.

    3. gtk 4:

      All found Gtk 4 immodule files exist.

Configuration:

Fcitx Addons:

  1. Addon Config Dir:

    Found fcitx5 addon config directory: /usr/share/fcitx5/addon.

  2. Addon List:

    1. Found 25 enabled addons:

      Simplified and Traditional Chinese Translation
      Classic User Inteface
      Clipboard
      Cloud Pinyin
      DBus
      DBus Frontend
      Emoji
      Fcitx4 Frontend
      Full width character
      IBus Frontend
      Input method selector
      Keyboard
      KDE Input Method Panel
      Status Notifier
      Notification
      Pinyin
      Extra Pinyin functionality
      Punctuation
      Quick Phrase
      Spell
      Unicode
      Wayland
      Wayland Input method frontend
      XCB
      X Input Method Frontend
      
    2. Found 0 disabled addons:

  3. Addon Libraries:

    All libraries for all addons are found.

  4. User Interface:

    Found 2 enabled user interface addons:

    Classic User Inteface
    KDE Input Method Panel
    

Log:

  1. date:

    2021年 11月 16日 星期二 21:14:23 CST
    
  2. /home/mystic/.config/fcitx5/crash.log:

    /crash.log not found.

@wengxt
Copy link
Member

wengxt commented Nov 16, 2021

Are you using chrome + ozone wayland? What's the version of chrome?

@pplmx
Copy link
Author

pplmx commented Nov 17, 2021

Sorry, I don't know ozone.
Chrome: Version 96.0.4664.45 (Official Build) (64-bit)
Other Info:

❯ cat /etc/debian_version
11.0
❯ cat /etc/os-release
PRETTY_NAME="Ubuntu 21.10"
NAME="Ubuntu"
VERSION_ID="21.10"
VERSION="21.10 (Impish Indri)"
VERSION_CODENAME=impish
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=impish
❯ uname -a
Linux Aurora 5.13.0-21-generic #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

@wengxt
Copy link
Member

wengxt commented Nov 18, 2021

Looks like it's just not set environment variable correctly. Just try run im-config and select fcitx 5.

@wengxt wengxt closed this as completed Nov 18, 2021
@pplmx
Copy link
Author

pplmx commented Nov 23, 2021

Not work. I have already selected fcitx5. It will work fine from time to time, which is so strange.

@pplmx pplmx changed the title Cannot work on Chrome. (It can work on the Ubuntu Terminal) fcitx only works on default application, and cannot work on the third app Nov 23, 2021
@pplmx pplmx changed the title fcitx only works on default application, and cannot work on the third app fcitx5 only works on default application, and cannot work on the third app Nov 23, 2021
@pplmx
Copy link
Author

pplmx commented Nov 23, 2021

Hi, @wengxt
I have tried some cases:

Works fine App

  • firefox
  • terminal

Not work fine App

  • Chrome
  • typora

My OS default language is English, not Chinese. I just only installed Chinese. Is this the root cause?

@wengxt
Copy link
Member

wengxt commented Nov 23, 2021

typora works for me as a Xwayland application. If you somehow launch chrome and typora in ozone+wayland mode, it might not work.

See
https://bugs.chromium.org/p/chromium/issues/detail?id=1183262
https://bugs.chromium.org/p/chromium/issues/detail?id=1265118

Also it need to be able to load system gtk library.

@wengxt
Copy link
Member

wengxt commented Nov 23, 2021

Also it really depends on how you install typora and chrome. I don't know if snap version in ubuntu has fcitx support or not. I use the deb version of typora on archlinux and it works fine.

If your typora and chrome is from snap store, I'd suggest you report bug to ubuntu to make them include fcitx im module.

@pplmx
Copy link
Author

pplmx commented Nov 26, 2021

Thank you for your prompt reply.
If I fixed it, I would update it here. :)

@pplmx
Copy link
Author

pplmx commented Nov 26, 2021

Re-install fcitx and fcitx-googlepinyin, it works fine.
So I think it is a fcitx5 issue. Please spend some time investigating it.

@yuyichao
Copy link
Member

FWIW, if reinstallation makes any difference, it's an issue with the installation and configuration, not fcitx.

@wengxt
Copy link
Member

wengxt commented Nov 26, 2021

Especially when you say "fcitx-googlepinyin", then it's not fcitx5 but fcitx 4?

@pplmx
Copy link
Author

pplmx commented Nov 27, 2021

Yep, I know fcitx4 and fcitx5. I mean that fcitx4 of the same series can be used, but not fcitx5. So I guess fcitx5 caused the failure.

@wengxt
Copy link
Member

wengxt commented Nov 27, 2021 via email

@pplmx
Copy link
Author

pplmx commented Nov 27, 2021

BTW, fcitx-googlepinyin works by switching the keyboard, not input method.
It seems that the way of switching the input method cannot work on Ubuntu 21.10.
Even if the fcitx5-pinyin can work fine by switching input method, while it only works on default app on Ubuntu 21.10.

@razielvamp666
Copy link

razielvamp666 commented Jul 25, 2022

Same bug
I have two Inputs:

  • Japanese + Mozc (Default Group)
  • Russian (added through input sources of Ubuntu settings window)

I can switch between languages in terminal but (at least) Firefox and Chrome always printing english alpabet instead cyrillic.


Solved problem above by adding startup script to gnome session:

sleep 3 && export layouts=$(/usr/bin/gsettings get org.gnome.desktop.input-sources sources) && /usr/bin/gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us')]" && sleep 0.5 && /usr/bin/gsettings set org.gnome.desktop.input-sources sources "${layouts}"

This script temporarily set only English (US) input source and after that restore original sources. Probably that is not fcitx problem, but this problem didn't appear with iBus

@wengxt
Copy link
Member

wengxt commented Jul 26, 2022

Same bug I have two Inputs:

* Japanese + Mozc (Default Group)

* Russian (added through input sources of Ubuntu settings window)

I can switch between languages in terminal but (at least) Firefox and Chrome always printing english alpabet instead cyrillic.

Solved problem above by adding startup script to gnome session:

sleep 3 && export layouts=$(/usr/bin/gsettings get org.gnome.desktop.input-sources sources) && /usr/bin/gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us')]" && sleep 0.5 && /usr/bin/gsettings set org.gnome.desktop.input-sources sources "${layouts}"

This script temporarily set only English (US) input source and after that restore original sources. Probably that is not fcitx problem, but this problem didn't appear with iBus

Are you using wayland? If so it's kinda a known issue. X11 should be OK.

Also, yes indeed, there's plan to use gsettings to set global layouts under gnome.

@razielvamp666
Copy link

Are you using wayland? If so it's kinda a known issue. X11 should be OK.

@wengxt
Yes, I'm using wayland. Is there any solution for this problem for wayland?
My solution is working but it is some kind of a not smart solution... I don't like it

@wengxt
Copy link
Member

wengxt commented Jul 26, 2022

@razielvamp666 one option is that you just don't use the input method group, and put everything in the same group. But you probably don't want that.

Wayland doesn't have a similar thing like setxkbmap that is generic to all desktop. Every desktop now has its own way to set layout. Right now changing system layout with fcitx only supports KDE.

I guess you might need to wait until fcitx support it.. and it will just use the similar approach like your script actually.

@liuxuzxx
Copy link

The fcitx5 can only input chinese word in Terminal ,can not input Chinese in vscode ,chrome ,firefox etc......

@wengxt
Copy link
Member

wengxt commented Jul 26, 2022

The fcitx5 can only input chinese word in Terminal ,can not input Chinese in vscode ,chrome ,firefox etc......

please use https://github.com/fcitx/fcitx5/discussions to ask questions. Especially, don't reply on a closed issue.

When you ask, please include the output of fcitx5-diagnose.

@moxak
Copy link

moxak commented May 3, 2023

I have the same problem.

In my environment, I was able to enter letters by launching a third application from the terminal.

@moxak
Copy link

moxak commented May 3, 2023

The following solution worked in my environment.

  • OS: Linux 6.2.13-arch1-1 x86_64 GNU/Linux
  • Session, DE: Wayland(GNOME)

Wayland does not have files that are executed at session startup such as .xprofile and .xinitrc to begin with, so I created ~/.config/environment.d/profile.conf and specified

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

Now fcitx5 is recognized on the Wayland session and can be run by third-party apps launched from outside of bash.

@GrimPixel
Copy link

I had the same problem, using MATE on Arch Linux. The key is typing
XMODIFIERS="@im=fcitx"
instead of
XMODIFIERS=@im=fcitx as seen on the official page.
So, could you add this to that page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants