forked from lyfeyaj/sublime-text-imfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sublime-imfix
executable file
·141 lines (121 loc) · 4.25 KB
/
sublime-imfix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
echo "Checking for installation of Sublime Text 3..........."
if which subl
then
echo ".............................................Installed"
else
echo "It seems you do not install Sublime Text 3 in your system."
echo -n 'Do you want to install it? [Y/N]: '
read sublime_input
if [ $sublime_input == 'Y' ] || [ $sublime_input == 'y' ]
then
echo ''
echo '*********** Adding Sublime Text 3 PPA **********************'
echo ''
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
echo ''
echo '*********** Updating system ********************************'
echo ''
sudo apt-get update >> /dev/null
echo ''
echo '*********** Installing Sublime Text 3 **********************'
echo ''
sudo apt-get install -y sublime-text >> /dev/null
echo ''
echo '*********** Sublime Text 3 installed successfully **********'
else
echo ''
echo '*********** Skip installing Sublime Text 3 *****************'
fi
fi
echo ''
echo "Checking for installation of Fcitx Input Methods...."
if which fcitx
then
echo "...........................................Installed"
else
echo "It seems that you do not install Fcitx Input Method in your system."
echo -n 'Do you want to install it? [Y/N]: '
read fcitx_input
if [ $fcitx_input == 'Y' ] || [ $fcitx_input == 'y' ]
then
echo ''
echo '*********** Adding Fcitx PPA *******************************'
echo ''
sudo add-apt-repository -y ppa:fcitx-team/nightly
echo ''
echo '*********** Updating system ********************************'
echo ''
sudo apt-get update >> /dev/null
echo ''
echo '*********** Installing Fcitx and Pinyin methods ************'
echo ''
sudo apt-get install -y fcitx fcitx-config-gtk fcitx-sunpinyin fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sogoupinyin >> /dev/null
echo ''
echo '*********** Installing Fcitx related libs ******************'
echo ''
sudo apt-get install -y build-essential libgtk2.0-dev >> /dev/null
sudo apt-get install -y fcitx-table-all >> /dev/null
echo ''
echo '*********** Fcitx installed successfully! *******************'
echo ''
echo '*********** Setting Fcitx as the default input method! ******'
im-switch -s fcitx -z default
else
echo ''
echo '*********** Skip installing Sublime Text 3 *****************'
fi
fi
if which subl && which fcitx
then
echo ''
echo '*********** Adding shared lib to sublime directory ***********'
echo ''
echo '*********** Checking for existing file ***********************'
if [ -e '/opt/sublime_text/libsublime-imfix.so' ]
then
echo ''
echo '*********** replacing libsublime-imfix.so with new one *******'
sudo rm /opt/sublime_text/libsublime-imfix.so
sudo cp ./lib/libsublime-imfix.so /opt/sublime_text/
else
sudo cp ./lib/libsublime-imfix.so /opt/sublime_text/
fi
echo ''
echo '*********** Replacing subl with new one **********************'
echo ''
if [ -e '/usr/bin/subl' ]
then
sudo rm /usr/bin/subl
fi
sudo cp ./src/subl /usr/bin/
echo '*********** Replacing sublime-text.desktop with new one ******'
for file in /usr/share/applications/sublime{-,_}text.desktop; do
if [ -e $file ]
then
sudo rm $file && sudo cp ./src/sublime-text.desktop /usr/share/applications/
sudo chmod 644 /usr/share/applications/sublime-text.desktop
break
fi
done
echo ''
echo '*********** Sublime Text input method problem fixed! *********'
echo ''
echo '*********** More: Installing extra skins *********************'
echo ''
echo '*********** Unpacking skin into current directory ************'
echo ''
tar -zxvf src/anran.tar.gz
echo '** Copying skin to Fcitx skin directory: /usr/share/fcitx/skin **'
echo ''
sudo cp -r anran /usr/share/fcitx/skin/
rm -r anran
echo 'Done!'
echo ''
echo 'Thanks for using this script to fix CJK Input Method problem of SublimeText 2/3.'
echo ''
echo 'Re-login your X windows and start to use SublimeText 2/3 with Fcitx!'
else
echo -e '\033[31mSublimeText 2/3 or Fcitx is not installed on your system, please recheck!\033[39m'
fi