Skip to main content

ibus 输入法配置

最近scim总把我的系统搞死,实在不能忍了。 本想转scim-python,但是svn上的代码居然不能编译。

这是想到了ibus,听说好久了,就是一直没有尝试。这次总算“被迫”试用了。

我的系统是ubuntu8.10 64bit

http://forum.ubuntu.org.cn/viewtopic.php?p=915368上查到了有用的步骤,这里提下简要过程,以及和原链接不同的地方:

1.编译安装dbus-python,ibus依赖0.83以上的版本

2.编译ibus引擎,我这里用git clone下载的,没有confiure,所以用autogen.sh,后来发现不用sudo还不行,是gettext的autopoint出了问题,所以只好用sudo了。另外我这里make也需要sudo,很奇怪

命令是:
sudo ./autogen.sh --prefix=/usr

3编译码表,我下了pinyin, anthy和table(这个里面包含了wu86, wu98, erbi,还有些其他的),编译安装,命令同上,注意安装五笔需要--enable-wu86或--enable-wu98

4运行ibus看是否正常,运行ibus-setup进行配置

5.把ibus注册为gtk的输入法
编辑/usr/lib/gtk-2.0/2.10.0/immodule-files.d/libgtk2.0-0.immodules
在文件到最后添加两行:
"/usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.so"
"ibus" "ibus Input Method" "gtk20" "/usr/share/locale" "zh"
这样在一些文本框里点右键就能找到ibus了

6.注册给im-switch,替换掉scim或scim-bridge
1) 建立文件/etc/X11/xinit/xinput.d/ibus,内容为
XIM=ibus
XIM_PROGRAM=/usr/bin/ibus
XIM_ARGS=""
GTK_IM_MODULE=ibus

2) sudo update-alternatives --install /etc/X11/xinit/xinput.d/zh_CN xinput-zh_CN /etc/X11/xinit/xinput.d/ibus 50

3)sudo im-switch -c,然后选ibus那一项

7.重新登录应该就没问题。

注,安装五笔时我出了些问题,当时我最初是enable了98,然后发现不爽,想换回86,然后configure wubi86时忘了打--prefix=/usr结果一塌糊涂。最后倒是解决了,整理经验教训如下

8.需要删除engine时,除了删除/usr/share/ibus/engine 下的对应文件,如果设置了preload,还要去gconf里删除/desktop/ibus/general/preload_engines里的项目

9.用--prefix=/usr/local/(也就是不加--prefix)编译安装运行后,/usr/share/ibus/engine里会多出一个engine文件,我这里是wubi86.engine,然而make uninstall和用--prefix=/usr编译安装后这个文件里面的Icon字段仍然指向/usr/local,所以需要删除该文件再make install

试了一下,确实是很好用的输入法。

Comments

seenxu said…
非常感谢这篇文章,想问一下,用ibus大概占用多少内存? 如果低于scim的状态,我也想换了,之前用过scim-python, fitx内存占用都不理想。
Lu Wang said…
我开了拼音,五笔和anthy输入法,一共用了68M多一点的内存。用scim的时候没有测过,所以我无法比较。
seenxu said…
多谢!scim还是更小一些,我用amd64, 开机以后大概用25mb,逐渐使用后40mb,我还是不换了,继续用scim.

Popular posts from this blog

Determine Perspective Lines With Off-page Vanishing Point

In perspective drawing, a vanishing point represents a group of parallel lines, in other words, a direction. For any point on the paper, if we want a line towards the same direction (in the 3d space), we simply draw a line through it and the vanishing point. But sometimes the vanishing point is too far away, such that it is outside the paper/canvas. In this example, we have a point P and two perspective lines L1 and L2. The vanishing point VP is naturally the intersection of L1 and L2. The task is to draw a line through P and VP, without having VP on the paper. I am aware of a few traditional solutions: 1. Use extra pieces of paper such that we can extend L1 and L2 until we see VP. 2. Draw everything in a smaller scale, such that we can see both P and VP on the paper. Draw the line and scale everything back. 3. Draw a perspective grid using the Brewer Method. #1 and #2 might be quite practical. #3 may not guarantee a solution, unless we can measure distances/p...

Hardware Password Manager

[Updates 2025-01-20] The original blog post assumes that all passwords are stored in one password manager, and the password manager either unlocks everything or nothing (e.g. Keepass). After discussing with friends, I realized that if I use something like pass , and I use a hardware GPG token, I can actually store and sync all encrypted passwords to all devices, because I will only decrypt the passwords on demand, and the computer will not see the GPG private key. The compromise is that the computer will see the list of all password entries (e.g. accounts), as well as a few other issues . I've been using Keepass for many years. I don't use online password services because I cannot fully trust them. Besides, I may not always have Internet connection, which is why I also don't use a self-hosted service. Everything has been working fine, until I turn my paranoid knob to the max. Here's the thought experiment . The Imaginary Scenario Let's say I have 100 PCs for differe...

Installing Linux on Surface Pro 1g

Windows 10 will soon reach its end of life, and my 1-gen Surface Pro is not supported by Windows 11. I (finally) decided to install Linux to it. Fortunately, it's a not-so-easy nice adventure: The device has only one USB port, so I have to bring back my 10+-year old USB hub. My live USB drive cannot boot directly, I have to disable Secure Boot first, by holding Volume Up during boot. I think years ago I learned that booting on USB might not work through a USB hub, but fortunatelly it worked well with my setup. This is done by holding Volume Down during boot. Wifi adapter was detected in the live Linux environment, but not functional. And I don't have a USB-Ethernet adapter. Luckily, nowadays we have USB-tethering from Android phones, which works out-of-the-box. Originally I planned to following this guide to set up root on ZFS, however, the system froze when building the ZFS kernel module. Then I decided to just use EXT4, yet I still learned a lot from the guide about disk par...