Install sublime text for elementary os

时间:2023-03-08 23:05:30
Install sublime text for elementary os

1. download sublime_text_3_build_3176_x86.tar.gz from http://www.sublimetext.com/3

2. extract it to /opt/sublime_text_3

3. then we can run sublime from shell:

cd /opt/sublime_text_3

./sublime_text

4. register sublime

#add the following lines into /etc/hosts or C:/windows/system32/driver/etc/hosts for windows

127.0.0.1  www.sublimetext.com

127.0.0.1  license.sublimehq.com

#then use the license key

----- BEGIN LICENSE -----
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
76E84F0B CD69BFC7 59F2DFEF E267328F
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
969624E7 DC9CD4D5 717FB40C 1B9738CF
20B3C4F1 E917B5B3 87C38D9C ACCE7DD8
5F7EF854 86B9743C FADC04AA FB0DA5C0
F913BE58 42FEA319 F954EFDD AE881E0B
------ END LICENSE ------

5. fix Chinese input issue

#1 downloade sublime-text-imfix-master.zip from https://github.com/lyfeyaj/

#2 copy sublime-text-imfix-master/lib/libsublime-imfix.so to /opt/sublime_text_3/

#3 create a launcher proxy for sublime_text

vi /usr/bin/subl

#!/bin/bash
LD_PRELOAD=/opt/sublime_text_3/libsublime-imfix.so exec /opt/sublime_text_3/sublime_text "$@"

chmod 755 /usr/bin/subl

Then you can run sublime with subl and input Chinese characters.

6. modify sublime_text.desktop so that sublime run through desktop icon  supports Chinese charachers input.

[Desktop Entry]

...

Exec=bash -c "LD_PRELOAD=/opt/sublime_text_3/libsublime-imfix.so /opt/sublime_text_3/sublime_text %F"

[Desktop Action Window]

...

Exec=bash -c "LD_PRELOAD=/opt/sublime_text_3/libsublime-imfix.so /opt/sublime_text_3/sublime_text -n"

[Desktop Action Document]
...
Exec=bash -c "LD_PRELOAD=/opt/sublime_text_3/libsublime-imfix.so /opt/sublime_text_3/sublime_text --command new_file"

7. Creat dock item for sublime_text

#1 copy sublime_text.desktop to /usr/share/applications/

#2 modify icon path as

Icon=/opt/sublime_text_3/Icon/32x32/sublime_text.png

#3 start sublime

subl

then will can find it's icon on dock bar. Right click it we can see "keep in Dock" option.

[Mark]

For elementary or ubuntu,

Directory /usr/shar/applications includes all desktop configure files.

But for every user items in ~/.config/plank/dock1/launchers are really shown on dock bar.

However, we can't create a similar item in this directory directly.

If an application's desktop file are copied to /usr/share/applications we can dock it to dock bar by right clicking the icon. Otherwise, you can't find the related operation.