diff --git a/README.md b/README.md index 626c99f..3e45d69 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ D library for working with *.desktop* files. Desktop entries in Freedesktop worl [![Build Status](https://travis-ci.org/MyLittleRobo/desktopfile.svg?branch=master)](https://travis-ci.org/MyLittleRobo/desktopfile) [![Coverage Status](https://coveralls.io/repos/MyLittleRobo/desktopfile/badge.svg?branch=master&service=github)](https://coveralls.io/github/MyLittleRobo/desktopfile?branch=master) +[Online documentation](https://mylittlerobo.github.io/d-freedesktop/docs/desktopfile.html) + Most desktop environments on GNU/Linux and BSD flavors follow [Desktop Entry Specification](https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/) today. The goal of **desktopfile** library is to provide implementation of this specification in D programming language. Please feel free to propose enchancements or report any related bugs to *Issues* page. diff --git a/source/desktopfile/file.d b/source/desktopfile/file.d index e97dd1e..4524d05 100644 --- a/source/desktopfile/file.d +++ b/source/desktopfile/file.d @@ -22,7 +22,7 @@ private @trusted void validateDesktopKeyImpl(string groupName, string key, strin } /** - * Subclass of IniLikeGroup for easy access to desktop action. + * Subclass of $(D inilike.file.IniLikeGroup) for easy access to desktop action. */ final class DesktopAction : IniLikeGroup { @@ -96,7 +96,7 @@ public: } /** - * Subclass of IniLikeGroup for easy accessing of Desktop Entry properties. + * Subclass of $(D inilike.file.IniLikeGroup) for easy accessing of Desktop Entry properties. */ final class DesktopEntry : IniLikeGroup { @@ -147,7 +147,7 @@ final class DesktopEntry : IniLikeGroup /** * Sets "Type" field to type - * Note: Setting the Type.Unknown removes type field. + * Note: Setting the $(D Type.Unknown) removes type field. */ @safe Type type(Type t) { final switch(t) { @@ -293,7 +293,9 @@ final class DesktopEntry : IniLikeGroup } /** - * Value used to determine if the program is actually installed. If the path is not an absolute path, the file should be looked up in the $(B 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). + * Value used to determine if the program is actually installed. + * + * If the path is not an absolute path, the file should be looked up in the $(B 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). * Returns: The value associated with "TryExec" key. * See_Also: $(D execValue) */ @@ -575,7 +577,7 @@ final class DesktopEntry : IniLikeGroup /** * Check if desktop file should be shown in menu of specific desktop environment. * Params: - * desktopEnvironment = Name of desktop environment, usually detected by XDG_CURRENT_DESKTOP variable. + * desktopEnvironment = Name of desktop environment, usually detected by $(B XDG_CURRENT_DESKTOP) variable. * See_Also: $(LINK2 https://specifications.freedesktop.org/menu-spec/latest/apb.html, Registered OnlyShowIn Environments), $(D notShowIn), $(D onlyShowIn) */ @trusted bool showIn(string desktopEnvironment) @@ -650,7 +652,7 @@ public: ///Options to manage desktop file reading static struct DesktopReadOptions { - ///Base $(B ReadOptions) of $(B IniLikeFile). + ///Base $(D inilike.file.IniLikeFile.ReadOptions). IniLikeFile.ReadOptions baseOptions; alias baseOptions this; @@ -822,7 +824,7 @@ public: * Reads desktop file from file. * Throws: * $(B ErrnoException) if file could not be opened. - * $(B IniLikeReadException) if error occured while reading the file or "Desktop Entry" group is missing. + * $(D inilike.file.IniLikeReadException) if error occured while reading the file or "Desktop Entry" group is missing. */ @trusted this(string fileName, DesktopReadOptions options = DesktopReadOptions.init) { this(iniLikeFileReader(fileName), options, fileName); @@ -831,7 +833,7 @@ public: /** * Reads desktop file from IniLikeReader, e.g. acquired from iniLikeFileReader or iniLikeStringReader. * Throws: - * $(B IniLikeReadException) if error occured while parsing or "Desktop Entry" group is missing. + * $(D inilike.file.IniLikeReadException) if error occured while parsing or "Desktop Entry" group is missing. */ this(IniLikeReader)(IniLikeReader reader, DesktopReadOptions options = DesktopReadOptions.init, string fileName = null) { @@ -844,7 +846,7 @@ public: /** * Reads desktop file from IniLikeReader, e.g. acquired from iniLikeFileReader or iniLikeStringReader. * Throws: - * $(B IniLikeReadException) if error occured while parsing or "Desktop Entry" group is missing. + * $(D inilike.file.IniLikeReadException) if error occured while parsing or "Desktop Entry" group is missing. */ this(IniLikeReader)(IniLikeReader reader, string fileName, DesktopReadOptions options = DesktopReadOptions.init) { @@ -1146,6 +1148,7 @@ Icon[ru]=folder_ru`; /** * Starts the application associated with this .desktop file using urls as command line params. + * * If the program should be run in terminal it tries to find system defined terminal emulator to run in. * Params: * urls = urls application will start with. @@ -1198,7 +1201,7 @@ Icon[ru]=folder_ru`; } } - ///ditto, but uses the only url. + ///Starts the application associated with this .desktop file using url as command line params. @trusted Pid startApplication(string url, string locale = null, lazy const(string)[] terminalCommand = getTerminalCommand) const { return startApplication([url], locale, terminalCommand); } @@ -1229,7 +1232,7 @@ Icon[ru]=folder_ru`; * Starts application or open link depending on desktop entry type. * Throws: * ProcessException on failure to start the process. - * Exception if type is Unknown or Directory. + * Exception if type is $(D DesktopEntry.Type.Unknown) or $(D DesktopEntry.Type.Directory). * See_Also: $(D startApplication), $(D startLink) */ @trusted void start() const diff --git a/source/desktopfile/utils.d b/source/desktopfile/utils.d index 7f31fbc..688ba59 100644 --- a/source/desktopfile/utils.d +++ b/source/desktopfile/utils.d @@ -221,13 +221,14 @@ unittest } /** - * Apply unquoting to Exec value making it into an array of escaped arguments. It automatically performs quote-related unescaping. Read more: [specification](http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html). + * Apply unquoting to Exec value making it into an array of escaped arguments. It automatically performs quote-related unescaping. * Params: * value = value of Exec key. Must be unescaped by unescapeValue before passing. * Throws: * $(D DesktopExecException) if string can't be unquoted (e.g. no pair quote). * Note: * Although Desktop Entry Specification says that arguments must be quoted by double quote, for compatibility reasons this implementation also recognizes single quotes. + * See_Also: $(LINK2 http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html, specification) */ @trusted auto unquoteExec(string value) pure { @@ -333,7 +334,7 @@ private @trusted string urlToFilePath(string url) nothrow pure } /** - * Expand Exec arguments (usually returned by unquoteExec) replacing field codes with given values, making the array suitable for passing to spawnProcess. Deprecated field codes are ignored. + * Expand Exec arguments (usually returned by $(D unquoteExec)) replacing field codes with given values, making the array suitable for passing to spawnProcess. Deprecated field codes are ignored. * Note: * Returned array may be empty and should be checked before passing to spawnProcess. * Params: @@ -691,6 +692,7 @@ unittest /** * Detect command which will run program in terminal emulator. + * * On Freedesktop it looks for x-terminal-emulator first. If found ["/path/to/x-terminal-emulator", "-e"] is returned. * Otherwise it looks for xdg-terminal. If found ["/path/to/xdg-terminal"] is returned. * Otherwise it tries to detect your desktop environment and find default terminal emulator for it. @@ -1187,9 +1189,11 @@ static if (isFreedesktop) } /** - * Check if .desktop file is trusted. This is not actually part of Desktop File Specification but many file managers has this concept. - * The trusted .desktop file is a file the current user has executable access to or the owner of which is root. - * This function should be applicable only to desktop files of Application type. + * Check if .desktop file is trusted. + * + * This is not actually part of Desktop File Specification but many desktop envrionments have this concept. + * The trusted .desktop file is a file the current user has executable access on or the owner of which is root. + * This function should be applicable only to desktop files of $(D DesktopEntry.Type.Application) type. * Note: Always returns true on non-posix systems. */ @trusted bool isTrusted(string appFileName) nothrow