fcitx输入法在wps、wineqq中失灵问题的解决

最近由Mint转到了Open SUSE下,各类折腾。bash

眼看着已经折腾差很少了,今天又遇到个问题:app

在Wineqq以及wps下,fcitx输入法打不开,无法输入中文。测试

这就很是坑了,这两个软件输入不了中文,基本就至关于没安装。因而乎上网各类查。网上查到的教程上大部分都是说这是由于有几个环境变量没有配置正确形成的。按照网上的方法,分别在~/.bashrc ~/.xprofile /etc/profile 文件中添加了以下代码:spa

export XIM="fcitx"
export XIM_PROGRAM="fcitx"
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE="fcitx"
export QT_IM_MODULE="fcitx"

重启,发现仍是很差使。命令行

偶然发现,若是在命令行中运行wps等命令,fcitx就好使。初步怀疑是上面配置的环境变量在双击运行的时候未生效形成的。code

写一脚本,测试,代码以下:教程

#!/usr/bin/sh
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE="fcitx"
export QT_IM_MODULE="fcitx"
/usr/bin/wpp

保存为wpp.sh,将桌面上的wps-office-wpp.desktop目标地址改为该脚本以后,运行,好使了。
肯定是环境变量的问题了。ip

接下来,就能够对wps、wineqq作一下小改动。ci

Wine QQget

wineqq的运行脚本是/opt/longene/tm2013/tm2013.sh (我安装的是tm2013,qq2013同理)。编辑此脚本,在最开始加入

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

保存

WPS

对于wps,双击桌面图标运行的是/usr/bin/wps(wpp,et),因此须要用一个脚本,在执行程序以前,配置一下环境变量。实际脚本跟上面的测试脚本有一点点区别:

#!/usr/bin/sh
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE="fcitx"
export QT_IM_MODULE="fcitx"
/usr/bin/wpp "$1"   //modify:13-12-18

之因此将可执行文件后面加了个参数,是由于.desktop文件调用可执行文件的时候会传一个%f参数给可执行文件,咱们如今让它传给咱们的脚本,再由咱们的脚本调用

将调用wps、wpp、et的脚本都写好后,放到/opt/kingsoft/wps-office/office6/目录中,而后分别修改/usr/share/applications/目录中的wps-office-wps.desktop wps-office-wpp.desktop wps-office-et.desktop作以下修改(以wpp为例,其他相似):

#!/usr/bin/env xdg-open
[Desktop Entry]
Comment=Use Kingsoft Presentation to edit and play presentations.
Comment[zh_CN]=使用 WPS 演示编辑、播放演示文稿
#Exec=/usr/bin/wpp %f
Exec=/opt/kingsoft/wps-office/office6/wpp.sh %f   ####将上一行代码注释掉,增长本行
GenericName=Kingsoft Presentation
GenericName[zh_CN]=WPS 演示
MimeType=application/wps-office.dps;application/wps-office.dpt;application/wps-office.ppt;application/wps-office.pot;application/vnd.ms-powerpoint;application/vnd.mspowerpoint;application/mspowerpoint;application/powerpoint;application/x-mspowerpoint;application/wps-office.pptx;application/wps-office.potx;
Name=Kingsoft Presentation
Name[zh_CN]=WPS 演示
StartupNotify=false
Terminal=false
Type=Application
Categories=Office;Presentation;Qt;
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
Icon=wps-office-wppmain
InitialPreference=3

运行wps,成功


虽然问题是解决了,但如今仍是有几个问题,求高手指点:

  1. 在.desktop脚本中 %f 参数是什么意思

2. 为何在相应文件中配置了环境变量,在终端以外却很差使?

2013/12/18

  1. 更正bug:脚本中的最后一行应改成/usr/bin/wpp "$1"

  2. %f的做用 官方手册

%f A single file name, even if multiple files are selected. The system reading the desktop entry should recognize that the program in question cannot handle multiple file arguments, and it should should probably spawn and execute multiple copies of a program for each selected file if the program is not able to handle additional file arguments. If files are not on the local file system (i.e. are on HTTP or FTP locations), the files will be copied to the local file system and %f will be expanded to point at the temporary file. Used for programs that do not understand the URL syntax.

相关文章
相关标签/搜索