DesktopFile

Represents .desktop file.

Constructors

this
this()

Constructs DesktopFile with "Desktop Entry" group and Version set to 1.0

Alias This

desktopEntry

This alias allows to call functions related to "Desktop Entry" group without need to call desktopEntry explicitly.

Members

Enums

ReadOptions
enum ReadOptions
Undocumented in source.
Type
enum Type
Undocumented in source.

Functions

addGroup
DesktopGroup addGroup(string groupName)

Creates new group usin groupName.

byGroup
auto byGroup()

Range of groups in order how they are defined in .desktop file. The first group is always Desktop Entry.

categories
auto categories()

Categories this program belongs to.

categories
void categories(Range values)

Sets the list of values for the "Categories" list.

comment
string comment()

Tooltip for the entry, for example "View sites on the Internet".

desktopEntry
inout(DesktopGroup) desktopEntry()
execString
string execString()
expandExecString
string[] expandExecString(string[] urls)

Expands Exec string into the array of command line arguments to use to start the program.

fileName
string fileName()
genericName
string genericName()

Generic name of the application, for example "Web Browser".

group
inout(DesktopGroup) group(string groupName)
hidden
bool hidden()
iconName
string iconName()
keywords
auto keywords()

A list of strings which may be used in addition to other metadata to describe this entry.

keywords
void keywords(Range values)

Sets the list of values for the "Keywords" list.

localizedComment
string localizedComment(string locale)

ditto, but returns localized value.

localizedGenericName
string localizedGenericName(string locale)

ditto, but returns localized value.

localizedName
string localizedName(string locale)

ditto, but returns localized value.

mimeTypes
auto mimeTypes()

The MIME type(s) supported by this application.

mimeTypes
void mimeTypes(Range values)

Sets the list of values for the "MimeType" list.

name
string name()

Specific name of the application, for example "Mozilla".

noDisplay
bool noDisplay()
notShowIn
auto notShowIn()

A list of strings identifying the desktop environments that should not display a given desktop entry.

onlyShowIn
auto onlyShowIn()

A list of strings identifying the desktop environments that should display a given desktop entry.

saveToFile
void saveToFile(string fileName)

Saves object to file using Desktop File format.

saveToString
string saveToString()

Saves object to string using Desktop File format.

startApplication
Pid startApplication(string[] urls)

Starts the program associated with this .desktop file using urls as command line params. Note: If the program should be run in terminal it tries to find system defined terminal emulator to run in. First, it probes TERM environment variable. If not found, checks if /usr/bin/x-terminal-emulator exists on Linux and use it on success. Defaulted to xterm, if could not determine other terminal emulator. Note: This function does check if the type of desktop file is Application. It relies only on "Exec" value.

startApplication
Pid startApplication(string url)

ditto, but uses the only url.

startLink
Pid startLink()
Undocumented in source. Be warned that the author may not have intended to support it.
terminal
bool terminal()

Whether the program runs in a terminal window.

terminal
bool terminal(bool t)

Sets "Terminal" field to true or false.

tryExecString
string tryExecString()
type
Type type()
type
Type type(Type t)

Sets "Type" field to type

workingDirectory
string workingDirectory()

The working directory to run the program in.

Static functions

joinValues
string joinValues(Range values)

Join range of multiple values into a string using semicolon as separator. Adds trailing semicolon. If range is empty, empty string is returned.

loadFromFile
DesktopFile loadFromFile(string fileName, ReadOptions options)

Reads desktop file from file.

loadFromString
DesktopFile loadFromString(string contents, ReadOptions options, string fileName)

Reads desktop file from string.

splitValues
auto splitValues(string values)

Some keys can have multiple values, separated by semicolon. This function helps to parse such kind of strings to the range.

Meta