1.先下载文件,下载后将后缀改为.c 点我下载
- 安装 C/C++ 的编译环境和 gtk libgtk2.0-dev
# apt-get install build-essential
# apt-get install libgtk2.0-dev
- 编译共享内库
# gcc -shared -o libsublime-imfix.so sublime-imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
- 设置 LD_PRELOAD 并启动 Sublime Text
# LD_PRELOAD=./libsublime-imfix.so subl
- 修改 /usr/share/applications/sublime_text.desktop
[Desktop Entry]
[...]
Exec=env LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text %F
[...]
[Desktop Action Window]
[...]
Exec=env LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text -n
[...]
[Desktop Action Document]
[...]
Exec=env LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text --command new_file
[...]
不要忘了把 libsublime-imfix.so 放到 /opt/sublime_text/ 中
- 修改 /usr/bin/subl
export LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so
exec /opt/sublime_text/sublime_text "$@"
重启电脑,可以看到Sublime能够输入中文了。
评论 (0)