在fedora20上安装sublime text 3时发现,解压下载的sublime text 3后得到是一个文件夹,其中有可执行文件,并且有desktop文件。
关于linux desktop文件的介绍,阅读了IBM developerWorks 的 “ Linux Desktop Entry 文件深入解析 “
不知道为什么CSDN博客里禁用这个链接,把"."换成"。":
http://www。ibm。com/developerworks/cn/linux/l-cn-dtef/
我想把sublime放在home文件夹下的software下,于是修改了desktop文件。
原本desktop文件:
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;
修改后的desktop文件:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/home/ACM311/software/sublime_text_3/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=/home/ACM311/software/sublime_text_3/Icon/256x256/sublime-text.png
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/home/ACM311/software/sublime_text_3/sublime_text -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/home/ACM311/software/sublime_text_3/sublime_text --command new_file
OnlyShowIn=Unity;
将修改后的desktop文件用cp命令复制到/usr/share/applications下,这样在应用程序浏览器中就可以看到sublime了。