IT码农库

您当前所在位置:首页 > 操作系统 > Ubuntu/Debian

Ubuntu/Debian

亲测可用:Linux下桌面快捷方式创建实例

佚名 佚名2015-06-18Ubuntu/Debian3609
这篇文章主要介绍了亲测可用:Linux下桌面快捷方式创建实例,本文以sublime text 2为例子讲解如何创建桌面快捷方式,需要的朋友可以参考下

今天到网上搜ubuntu创建桌面快捷方式,发现尽是些不负责任,有问题的教程,故我也发教程一篇
在你的Home/Desktop文件夹下面新建一个xxx.desktop的文件,并且加上执行权限

复制代码
代码如下:

chmod +x xxx.desktop

具体内容参照下面的模板,顺便讲一下linux下软件的安装方法,以sublime text 2为例
下载sublime linux的安装包,在你的home目录新建一个目录名,可以叫app,或者myapps啥的,你自己明白就行,就是软件的安装目录,把sublime text 2解压到里面,于是整体的目录结构如下


复制代码
代码如下:

--home\yournam
----apps\
------sublime text 2\

下面解释下模板的内容,第一行,是凡是标有可执行标记的脚本必备的注释,内容为执行该脚本的解释器地址,这里是解释桌面快捷方式用的
第二行开始就是具体的内容了
解释两个重要的地方,地一个是exec,这个是你的可执行文件的地址,如果中间包含空格,那么用引号扩起来
Icon,这个是你的应用的图标,要不默认图标很难看


复制代码
代码如下:

#!/usr/bin/env xdg-open
[Desktop Entry]
Categories=Development;
Comment[zh_CN]=
Comment=
Exec="/home/bowman/apps/Sublime Text 2/sublime_text"
GenericName[zh_CN]=Sublime Texe 2
GenericName=Sublime Texe 2
Icon="/home/bowman/apps/Sublime Text 2/Icon/256x256/sublime_text.png"
MimeType=
Name[zh_CN]=Sublime Texe 2
Name=Sublime Texe 2
Path=
StartupNotify=true
Terminal=false
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=owen

关于category,这里有一个主要列表可供选择

he table below lists all Main Categories.
Main Category Description Notes
AudioVideo Application for presenting, creating, or processing multimedia (audio/video)
Audio An audio application Desktop entry must include AudioVideo as well
Video A video application Desktop entry must include AudioVideo as well
Development An application for development
Education Educational software
Game A game
Graphics Application for viewing, creating, or processing graphics
Network Network application such as a web browser
Office An office type application
Science Scientific software
Settings Settings applications Entries may appear in a separate menu or as part of a "Control Center"
System System application, "System Tools" such as say a log viewer or network monitor
Utility Small utility application, "Accessories"

references:
http://standards.freedesktop.org/menu-spec/latest/apa.html
http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

大图广告(830*140)