今天到網(wǎng)上搜ubuntu創(chuàng)建桌面快捷方式,發(fā)現(xiàn)盡是些不負(fù)責(zé)任,有問(wèn)題的教程,故我也發(fā)教程一篇
在你的Home/Desktop文件夾下面新建一個(gè)xxx.desktop的文件,并且加上執(zhí)行權(quán)限
chmod +x xxx.desktop
具體內(nèi)容參照下面的模板,順便講一下linux下軟件的安裝方法,以sublime text 2為例
下載sublime linux的安裝包,在你的home目錄新建一個(gè)目錄名,可以叫app,或者myapps啥的,你自己明白就行,就是軟件的安裝目錄,把sublime text 2解壓到里面,于是整體的目錄結(jié)構(gòu)如下
--home\yournam
----apps\
------sublime text 2\
下面解釋下模板的內(nèi)容,第一行,是凡是標(biāo)有可執(zhí)行標(biāo)記的腳本必備的注釋?zhuān)瑑?nèi)容為執(zhí)行該腳本的解釋器地址,這里是解釋桌面快捷方式用的
第二行開(kāi)始就是具體的內(nèi)容了
解釋兩個(gè)重要的地方,地一個(gè)是exec,這個(gè)是你的可執(zhí)行文件的地址,如果中間包含空格,那么用引號(hào)擴(kuò)起來(lái)
Icon,這個(gè)是你的應(yīng)用的圖標(biāo),要不默認(rèn)圖標(biāo)很難看
#!/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
關(guān)于category,這里有一個(gè)主要列表可供選擇
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#main-category-registry
http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html