desktopfile

Reading, writing and executing .desktop file

Public Imports

inilike
public import inilike;
Undocumented in source.

Members

Classes

DesktopExecException
class DesktopExecException

Exception thrown when "Exec" value of DesktopFile or DesktopAction is invalid.

DesktopFile
class DesktopFile

Represents .desktop file.

Functions

applicationsPaths
string[] applicationsPaths(string[] dataPaths)

Applications paths based on data paths. This function is available on all platforms, but requires dataPaths argument (e.g. C:\ProgramData\KDE\share on Windows)

applicationsPaths
string[] applicationsPaths()

ditto, but returns paths based on known data paths. It's practically the same as standardPaths(StandardPath.applications). This function is defined only on freedesktop systems to avoid confusion with other systems that have data paths not compatible with Desktop Entry Spec.

expandExecArgs
string[] expandExecArgs(string[] execArgs, string[] urls, string iconName, string name, string fileName)

Expand Exec arguments (usually returned by parseExecString) 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.

expandExecString
string[] expandExecString(string execString, string[] urls, string iconName, string name, string fileName)

Unquote, unescape Exec string and expand field codes substituting them with appropriate values.

getTerminalCommand
string[] getTerminalCommand()

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. If all guesses failed, it uses ["xterm", "-e"] as fallback. Note: This function always returns empty array on non-freedesktop systems.

parseExecString
string[] parseExecString(string execString)

Convenient function used to unquote and unescape Exec value into an array of arguments. Note: Parsed arguments still may contain field codes that should be appropriately expanded before passing to spawnProcess.

unescapeExecArgument
string unescapeExecArgument(string arg)

Unescape Exec argument as described in specification.

unquoteExecString
auto unquoteExecString(string value)

Unquote Exec value into an array of escaped arguments. If an argument was quoted then unescaping of quoted arguments is applied automatically. Note that unescaping of quoted argument is not the same as unquoting argument in general. Read more in specification.

writableApplicationsPath
string writableApplicationsPath()

Path where .desktop files can be stored without requiring of root privileges. It's practically the same as writablePath(StandardPath.applications). This function is defined only on freedesktop systems to avoid confusion with other systems that have data paths not compatible with Desktop Entry Spec. Note: it does not check if returned path exists and appears to be directory.

Structs

DesktopAction
struct DesktopAction

Adapter of IniLikeGroup for easy access to desktop action.

See Also

Meta