可能的重复:
.desktop 文件的语法是什么?
如何添加自定义启动器?
我更喜欢仅使用文本编辑器创建新的桌面启动器(.desktop 文件),例如创建我编写的 iotop 启动器:
[Desktop Entry]
Name=iotop
Exec=gksudo "gnome-terminal -x iotop"
Type=Application
Run Code Online (Sandbox Code Playgroud)
但我还没有找到任何关于格式的文档。有人可以给我一个格式规范的链接吗?
Sav*_*vic 18
.desktop 文件规范在这里:http : //standards.freedesktop.org/desktop-entry-spec/latest/
一个示例 .desktop 文件是:
[Desktop Entry]
Version=1.0
Type=Application
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview
MimeType=image/x-foo;
NotShowIn=KDE;
Run Code Online (Sandbox Code Playgroud)
通过指定语言,.desktop 文件可以集成翻译:
Name=Foo Viewer
Name[en_GB]=Foo Viewer
Name[el_GR]=??? ??????
Run Code Online (Sandbox Code Playgroud)
如果您想在统一面板图标中添加统一子菜单,那么您可以创建一个桌面文件。来自http://maketecheasier.com/8-really-useful-ubuntu-unity-quicklists/2011/05/07 的一个例子
首先复制原始 .desktop 文件并使用您喜欢的文本编辑器打开它:
cp /usr/share/applications/firefox.desktop ~/.local/share/applications
gedit ~/.local/share/applications/firefox.desktop
Run Code Online (Sandbox Code Playgroud)
然后编辑文件:
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
GenericName=Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;
StartupWMClass=Firefox
StartupNotify=true
X-Ayatana-Desktop-Shortcuts=NewWindow;Private;Safe;ProfileManager;MakeTechEasier
Name[en_US]=Firefox Web Browser
[NewWindow Shortcut Group]
Name=Open a New Window
Exec=firefox -new-window
TargetEnvironment=Unity
[Private Shortcut Group]
Name=Private Mode
Exec=firefox -private-toggle
TargetEnvironment=Unity
[Safe Shortcut Group]
Name=Safe Mode
Exec=firefox -safe-mode
TargetEnvironment=Unity
[ProfileManager Shortcut Group]
Name=Start Profile Manager
Exec=firefox -ProfileManager
TargetEnvironment=Unity
Run Code Online (Sandbox Code Playgroud)
现在运行nautilus ~/.local/share/applications/并将您新创建的“Firefox”统一桌面文件拖放到统一栏中。
mar*_*ars 10
.desktop 配置文件的格式是一个统一的标准,在 FreeDesktop.org Desktop Entry Specification 中有描述。这些文件指定了应用程序的启动方式、菜单中的显示方式等。
GNOME 开发中心有一个很好的教程,可以为您自己的应用程序创建这些文件。
| 归档时间: |
|
| 查看次数: |
20820 次 |
| 最近记录: |