lyfeyaj / sublime-text-imfix

Fix Sublime Text 3 Input method problem (CJK words) under Ubuntu
937 stars 194 forks source link

bugfix:SublimeText3命令行启动可以输入中文,图标启动无法输入中文 #26

Closed lsk-boy-f closed 7 years ago

lsk-boy-f commented 7 years ago

sublime版本:sublime text3 3126 linux版本: Ubuntu16.04LTS x64 出现问题的步骤:

  1. 安装3126版本的sublime
  2. 执行sublime-imfix脚本修复输入法问题 期望结果: 从命令行和图标打开均可以使用中文输入 实际结果: 从命令行打开sublime,可以输入中文;从图标打开sublime,无法输入中文

问题原因: sublime-imfix脚本中,替换desktop文件的流程如下: 判断/usr/share/applications下有没有叫做sublime-text.desktop的文件,如果有,则替换成本仓库src目录下的sublime-text.desktop. 可是,sublime text3安装时,创建的desktop文件名字实际为sublime_text.desktop,因此导致desktop没有被替换.最终出现图标打开sublime无法输入中文的问题.

lyfeyaj commented 7 years ago

Thanks for your contribution.

The file name has been changed once from sublime_text.desktop to sublime-text.desktop

So, the better way is to check existences of both sublime_text.desktop and sublime-text.desktop with following code:

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

Those codes has been updated to the sublime-imfix script, and your PR will be closed correspondingly.