First, the system has been successfully installed Sogou input method
Second, save the following code to the file Sublime_imfix.c (located in the ~ directory)
#include <gtk/gtkimcontext.h>void Gtk_im_context_set_client_window (gtkimcontext *context, GdkWindow *wi Ndow) {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);}
If the following issues occur
Then compile after entering the following command
sudo apt-get install Libgtk2.0-dev
Third, compile the code from the previous step into a shared library libsublime-imfix.so, command
Gcc-shared-o libsublime-imfix.so sublime_imfix.c ' pkg-config--libs--cflags gtk+-2.0 '-fPIC
Iv. Copy the libsublime-imfix.so to the folder where Sublime_text resides
sudo mv libsublime-imfix.so/opt/sublime_text/
V. Modify the contents of the file/usr/bin/subl
sudo gedit/usr/bin/subl
Will
#!/bin/shexec/opt/sublime_text/sublime_text "[Email protected]"
Revision changed to
#!/bin/shld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text "[Email protected]"
At this point, executing subl in the command will be able to use Sogou for Linux Chinese input
Six, in order to use the right mouse button to open the file can use Chinese input, 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
Ubuntu Solution Sublime Text3 Unable to lose the Chinese problem