At night after the reference on-line solution, practice a bit, solve the sublime in Linux under the Chinese input problem
1: Switch to the ~ directory and create a new sublime_imfix.c file
Touch sublime_imfix.c
2: Edit the Sublime_imfix.c file
Gedit sublime_imfix.c
Copy the following code into the open gedit
#include &NBSP;<GTK/GTKIMCONTEXT.H>VOID&NBSP;GTK _im_context_set_client_window (gtkimcontext *context, gdkwindow *window) { gtkimcontextclass *klass; g_return_if_ fail (gtk_is_im_context (context)); klass = gtk_im_context_get_class (context); if (Klass->set_client_window) klass->set_client_window (context, window); g_object_set_data (G_object (context), "window", window); if (! gdk_is_window (WINDOW)) return; int width = gdk_window_get_width ( window); int height = gdk_window_get_height (window); if (width != 0 && height !=0) gtk_im_context_focus_in (context);}
3: Compile the copied code file sublime_imfix.c to libsublime-imfix.so file.
CD ~gcc-shared-o libsublime-imfix.so sublime_imfix.c ' pkg-config--libs--cflags gtk+-2.0 '-fPIC
To this step there might be a mistake saying what "gtk/gtkimcontext.h: No file or directory"
At this point you open a new terminal to execute apt-get install Libgtk2.0-dev
4: Next execution
Gcc-shared-o libsublime-imfix.so sublime_imfix.c ' pkg-config--libs--cflags gtk+-2.0 '-fPIC
5: then copy the compiled libsublime-imfix.so file to the folder where Sublime_text is located.
sudo mv libsublime-imfix.so/opt/sublime_text/
6: Modify the contents of a file/usr/bin/subl
sudo gedit/usr/bin/subl
will be #!/bin/sh
Exec/opt/sublime_text/sublime_text "[Email protected]"
Replaced by
#!/bin/sh
ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text "[Email protected]"
7:: You also need to modify the contents of the file Sublime_text.desktop.
sudo gedit/usr/share/applications/sublime_text.desktop
Set the string in [Desktop Entry]
Exec=/opt/sublime_text/sublime_text%F
Revision changed to
Exec=bash-c "ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text%F"
string in [Desktop Action Window]
Exec=/opt/sublime_text/sublime_text-n
Revision changed to
Exec=bash-c "Ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text-n"
string in [Desktop Action Document]
Exec=/opt/sublime_text/sublime_text--command New_file
Revision changed to
Exec=bash-c "ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text--command New_ File
8: Finally, finally, best, open sublime, switch to Chinese input, try
10:shutdown-h now
Sleep, sleep , sleep.
The Chinese input problem of sublime text under Linux