您尚未登录。

#1 2023-11-10 16:30:18

ChillyRain
会员
注册时间: 2022-11-30
帖子: 2

[求助]关于KDE Wayland中Fcitx5的启动问题

KDE Plasma Version: 5.27.9
Fcitx5 Version: 5.1.4-1

在切换到plasma-wayland(以下简称wayland)之后,Fcitx5出现了一条通知(Using Fcitx5 on Wayland#KDE_Plasma),要求不再设置全局的"GTK_IM_MODULE"、"QT_IM_MODULE"以及"SDL_IM_MODULE",于是我在"/etc/environment"中对这两项进行了注释:

#GTK_IM_MODULE=fcitx
#QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
#SDL_IM_MODULE=fcitx
GLFW_IM_MODULE=ibus

重启系统之后Fcitx5使用良好,但是问题也来了。
wayland中启动Fcitx5的方式是将其作为"Virtual keyboard"启动,原有的autostart service和手动输入"/usr/bin/fcitx5"启动之后,都无法正常使用,并显示如下错误:

Fcitx should be launched by KWin under KDE Wayland in order to use Wayland input method frontend. 
This can improve the experience when using Fcitx on Wayland. 
To configure this, you need to go to "System Settings" -> "Virtual keyboard" and select "Fcitx 5" from it. 
You may also need to disable tools that launches input method, 
such as imsettings on Fedora, or im-config on Debian/Ubuntu. 
For more details see https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#KDE_Plasma

也就是说,在wayland中,用常规的程序启动方式启动Fcitx5无法奏效了,必须经由"KWin"这个组件来启动才行。
我尝试在"Virtual keyboard"页面将其应用成"None",又应用回"Fcitx5",果然触发了自动启动机制,通过这个步骤启动的Fcitx5是可以正常使用的。
Virtual keyboard页面(仅KDE):

kcmshell5 kcm_virtualkeyboard

在System Monitor中查看Fcitx5进程时,发现其跟这个服务有关联(Total Memory):

/user.slice/user-1000.slice/user@1000.service/session.slice/plasma-kwin_wayland.service

在不可使用时(手动使用restart或者/usr/bin/fcitx5启动)时的journctl输出如下:

Nov 10 16:23:23 arch-81yn kwin_wayland_wrapper[5924]: I2023-11-10 16:23:23.658409 addonmanager.cpp:193] Loaded addon fcitx4frontend
Nov 10 16:23:23 arch-81yn fcitx5-plasma-theme-generator[5929]: Will write new themes to:  "/home/zaky/.local/share/fcitx5/themes/plasma"
Nov 10 16:23:23 arch-81yn fcitx5-plasma-theme-generator[5929]: Notify theme reloading.

在使用正常时,通过Virtual keyboard启动Fcitx5的输出:

Nov 10 16:24:22 arch-81yn kwin_wayland_wrapper[6014]: I2023-11-10 16:24:22.887488 addonmanager.cpp:193] Loaded addon fcitx4frontend
Nov 10 16:24:23 arch-81yn fcitx5-plasma-theme-generator[6019]: Will write new themes to:  "/home/zaky/.local/share/fcitx5/themes/plasma"
Nov 10 16:24:23 arch-81yn fcitx5-plasma-theme-generator[6019]: Notify theme reloading.

乍一看好像没区别,那么现在在plasma-wayland下,如何启动Fcitx5才是正确的方式呢?

离线

#2 2023-11-10 19:33:07

Bryan2333
会员
注册时间: 2023-01-19
帖子: 104

Re: [求助]关于KDE Wayland中Fcitx5的启动问题

KDE Wayland默认情况下是以autostart service模式来启动Fcitx5,除非你手动在设置界面中设置Fcitx5为虚拟键盘,这样才会由KWin启动Fcitx5.

最近编辑记录 Bryan2333 (2023-11-10 19:33:38)

离线

#3 2023-11-10 23:30:27

ChillyRain
会员
注册时间: 2022-11-30
帖子: 2

Re: [求助]关于KDE Wayland中Fcitx5的启动问题

Bryan2333 说:

KDE Wayland默认情况下是以autostart service模式来启动Fcitx5,除非你手动在设置界面中设置Fcitx5为虚拟键盘,这样才会由KWin启动Fcitx5.

但这与Using Fcitx5 on Wayland#KDE_Plasma的内容相矛盾,在这个页面中,Fcitx5官方推荐通过设置Virtual keyboard来使KCM启动Fcitx5。
实际上,我更想知道的是如何“手动输入命令操作使KCM启动Fcitx5”,因为常规的启动方式已经无法使用Fcitx5了

离线

#4 2024-01-04 08:23:29

supersonictw
会员
注册时间: 2024-01-04
帖子: 1
个人网站

Re: [求助]关于KDE Wayland中Fcitx5的启动问题

我是Debian使用者,但設定方法應該是大同小異

請嘗試改用 $HOME/.config/plasma-workspace/env
來設定環境變數

修改使用者的預設殼層的設定檔(.bashrc/.zshrc/.zshenv)來設定也行
但第一個設定方式可以將該環境設定只留在Plasma環境內

使用者的 $HOME/.config/environment.d 也能運作
但這是會由systemd負責定義環境變數

請不要直接寫在 /etc/environment
這會破壞sddm的工作行為

詳細設定可參照
https://userbase.kde.org/Session_Environment_Variables
https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland

環境變數寫入範例:

tee -a $HOME/.config/plasma-workspace/env/fcitx.sh <<'EOF'
export GTK_IM_MODULE=fcitx
#export QT_IM_MODULE=fcitx # 設定了反而fcitx無法運作
export XMODIFIERS=@im=fcitx
EOF

並以 Virtual Keyboard 的方式來作為啟動Fcitx的使用方法
希望這些資訊能帶來給予您所需的幫助 smile

最近编辑记录 supersonictw (2024-01-10 10:05:58)

离线

页脚