The Sogou input method of Centos7 needs the support of Fcitx, alien, and ibus to run normally.
1 Install Fcitx framework
1.1 Shield ibus first
mv /usr/bin/ibus-daemon /usr/bin/ibus-daemon.bak
1.2 Install Fcitx and configure the environment
- Cheap Fcitx
yum install libQtWebKit* fcitx fcitx-libs fcitx-qt4 fcitx-qt5 fcitx-configtool fcitx-table fcitx-table-chinese
- Configure Fcitx's environment
vim /etc/profile
export XIM=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export QT4_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
2 Install alien and Sogou input method
2.1 Install alien
yum install alien
2.2 Download the Linux installation package of Sogou input method
a) Download the .deb package on the official website https://pinyin.sogou.com/linux/?r=pinyin, as shown in Figure (1):
https://ime.sogoucdn.com/dl/index/1608303807/sogoupinyin_2.4.0.2905_amd64.deb?st=aYnSHREyFTn6xOsQaK7avA&e=1608436053&fn=sogoupinyin_2.4.0.2905_amd64.deb
b) Then, convert the .deb package to .rpm format
alien -r sogoupinyin_2.2.0.0108_amd64.deb
c) Install input method
sudo rpm -ivh sogoupinyin-2.4.0.2905-2.x86_64.rpm --nodeps --force
d) Copy library files
cp -R /usr/lib/x86_64-linux-gnu/fcitx/* /usr/lib64/fcitx/
e) Change library file permissions
sudo chmod -R 755 /usr/lib64/fcitx/
3. Turn off gnome-shell's monitoring of the keyboard
gsettings set org.gnome.settings-daemon.plugins.keyboard active false
4. Initialize Sogou's .config configuration
rm -rf ~/.config/SogouPY
rm -rf ~/.config/SogouPY.users
rm -rf ~/.config/sogou-qimpanel
5. Restore the ibus path
sudo mv /usr/bin/ibus-daemon.backu /usr/bin/ibus-daemon
6. Start fcitx, and then restart the system
fcitx
reboot
7. Set the order and shortcut keys of Sogou input method
7.1 Open input method configuration
fcitx -r; fcitx-configtool
As shown in figure (2), press Sogou input method to set the second order.
And set the shortcut key for activation in Chinese and English to F8, as shown in Figure (3).
After Sogou input method is installed, the effect is as follows:
8. Activation method
When entering the system for the first time, you need to manually activate the Sogou input method, enter the following 2 commands in the console:
fcitx
fcitx -r; fcitx-configtool
Then, press F8 again.
9. Appendix
Sometimes ibus is deleted by mistake, making it impossible to enter the Centos desktop system, which results in a black screen. At this time, you can use the following two commands to restore.
systemctl enable gdm
reboot
or
systemctl enable gdm
sudo yum -y groups install "GNOME Desktop"
reboot
These two commands can restore ibus, so as to solve the black screen problem caused by the lack of ibus.