Ubuntu Solution Sublime Text3 Unable to lose the Chinese problem

Source: Internet
Author: User
Tags gtk

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.