我是靠谱客的博主 温柔爆米花,最近开发中收集的这篇文章主要介绍linux 桌面快捷方式[Desktop Entry],觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

以eclipse为例,最简单的Desktop Entry:

[Desktop Entry]
Exec=/opt/eclipse/eclipse
Type=Application

一般内容:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true 


主要的参数及其作用如下表【来源:http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html】


KeyDescriptionValue TypeREQ?Type
TypeThis specification defines 3 types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3). To allow the addition of new types in the future, implementations should ignore desktop entries with an unknown type.stringYES 
VersionVersion of the Desktop Entry Specification that the desktop entry conforms with. Entries that confirm with this version of the specification should use1.0. Note that the version field is not required to be present.stringNO1-3
NameSpecific name of the application, for example "Mozilla".localestringYES1-3
GenericNameGeneric name of the application, for example "Web Browser".localestringNO1-3
NoDisplayNoDisplay means "this application exists, but don't display it in the menus". This can be useful to e.g. associate this application with MIME types, so that it gets launched from a file manager (or other apps), without having a menu entry for it (there are tons of good reasons for this, including e.g. thenetscape -remote, or kfmclient openURL kind of stuff).booleanNO1-3
CommentTooltip for the entry, for example "View sites on the Internet". The value should not be redundant with the values ofName and GenericName.localestringNO1-3
IconIcon to display in file manager, menus, etc. If the name is an absolute path, the given file will be used. If the name is not an absolute path, the algorithm described in theIcon Theme Specification will be used to locate the icon.localestringNO1-3
HiddenHidden should have been called Deleted. It means the user deleted (at his level) something that was present (at an upper level, e.g. in the system dirs). It's strictly equivalent to the.desktop file not existing at all, as far as that user is concerned. This can also be used to "uninstall" existing files (e.g. due to a renaming) - by lettingmake install install a file with Hidden=true in it.booleanNO1-3
OnlyShowIn, NotShowInA list of strings identifying the environments that should display/not display a given desktop entry. Only one of these keys, eitherOnlyShowIn or NotShowIn, may appear in a group (for possible values see theDesktop Menu Specification).string(s)NO1-3
TryExecPath to an executable file on disk used to determine if the program is actually installed. If the path is not an absolute path, the file is looked up in the $PATH environment variable. If the file is not present or if it is not executable, the entry may be ignored (not be used in menus, for example).stringNO1
ExecProgram to execute, possibly with arguments. See the Exec key for details on how this key works.stringYES1
PathIf entry is of type Application, the working directory to run the program in.stringNO1
TerminalWhether the program runs in a terminal window.booleanNO1
ActionsIdentifiers for application actions. This can be used to tell the application to make a specific action, different from the default behavior. TheApplication actions section describes how actions work.string(s)NO1
MimeTypeThe MIME type(s) supported by this application.string(s)NO1
CategoriesCategories in which the entry should be shown in a menu (for possible values see theDesktop Menu Specification).string(s)NO1
KeywordsA list of strings which may be used in addition to other metadata to describe this entry. This can be useful e.g. to facilitate searching through entries. The values are not meant for display, and should not be redundant with the values ofName or GenericName.localestring(s)NO1
StartupNotifyIf true, it is KNOWN that the application will send a "remove"message when started with the DESKTOP_STARTUP_ID environment variable set.If false, it is KNOWN that the application does not workwith startup notification at all (does not shown any window, breakseven when using StartupWMClass, etc.).If absent, a reasonable handling is up to implementations (assuming false,using StartupWMClass, etc.). (See theStartup Notification Protocol Specification for more details).booleanNO1
StartupWMClassIf specified, it is known that the application will map at least onewindow with the given string as its WM class or WM name hint (see theStartup Notification Protocol Specification for more details).stringNO1
URLIf entry is Link type, the URL to access.stringYES2

更详细的内容:http://blog.chinaunix.net/uid-20332519-id-3015914.html


最后

以上就是温柔爆米花为你收集整理的linux 桌面快捷方式[Desktop Entry]的全部内容,希望文章能够帮你解决linux 桌面快捷方式[Desktop Entry]所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部