Google-chrome版本升级后sogou输入法不工作了
背景:
笔记本Thinkpad E450,操作系统Ubuntu 24.04.2 LTS,Chrome浏览器版本135.0.7049.114-1,Edge浏览器版本131.0.2903.99-1,输入法Sogou版本4.2.1.145
现象:
- **正常场景**:Edge中可通过Ctrl+Space切换搜狗输入法
- **异常场景**:Chrome中Ctrl+Space无响应,输入法状态栏不出现
似乎在Typora中也有相同的问题,不能使用sogou输入法。
分析过程:
之前sogou输入法在低版本chrome浏览器正常使用,后来升级chrome版本,就不工作了。网上提供的解决方案是尝试降低chrome浏览器版本,获得兼容并可继续在chrome browser中使用sogou输入法。
升级chrome版本是不可避免的过程,如果不升级也会带来其他的问题,因而不考虑降版本。
当前状态:
已确认问题:
▸ GTK3未编译Fcitx输入法模块
▸ IBus守护进程抢占输入法总线
1)查询谷歌版本
dpkg -l | grep google
andy@ThinkPad:~/Desktop$ dpkg -l | grep google
ii google-chrome-stable 135.0.7049.114-1 amd64 The web browser from Google
2)问题追踪
1.im-config -l
2.fcitx-diagnose
**Cannot find `gtk-query-immodules` for gtk 3**
**Cannot find fcitx im module for gtk 3.**
3.google-chrome --gtk-im-module=fcitx --enable-logging=stderr --v=1
google-chrome log>>
(chrome --gtk-im-module=fcitx --enable-logging=stderr --v=1:5686): Gtk-WARNING **: 13:57:10.217: No IM module matching GTK_IM_MODULE=fcitx found
[5686:5686:0505/135710.217860:VERBOSE1:input_method_context_impl_gtk.cc(95)] Using GTK IM context: ibus
存在2个问题:
No IM module matching GTK_IM_MODULE=fcitx found
Using GTK IM context: ibus
支持事项:
1)安装gtk3,gtk2已经过时了。
sudo apt install libgtk-3-dev gtk-doc-tools
gtk-query-settings --summary
2)环境变量设置
# 全局生效(需管理员权限)
sudo cat <<EOF>> /etc/environment
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
EOF
# 用户级生效
echo 'export GTK_IM_MODULE=fcitx' >> ~/.bashrc
echo 'export QT_IM_MODULE=fcitx' >> ~/.bashrc
cat <<EOF>> ~/.profile
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
EOF
source ~/.profile
3)缓存重建
dpkg -S gtk-query-immodules-3.0
sudo /usr/lib/x86_64-linux-gnu/libgtk-3-0t64/gtk-query-immodules-3.0 --update-cache
4)重启,打开chrome或typora测试,sogou恢复正常使用。
andy@ThinkPad:~/Desktop$ fcitx-diagnose | grep -E "GTK|Active"
1. gtk - `${GTK_IM_MODULE}`:
Environment variable GTK_IM_MODULE is set to "fcitx" correctly.