DesktopFile

Represents .desktop file.

Constructors

this
this(Range byLine, ReadOptions options, string fileName)
Undocumented in source.
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

Aliases

ReadOptions
alias ReadOptions = IniLikeFile.ReadOptions
Undocumented in source.

Enums

Type
enum Type

Desktop entry type

Functions

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.

genericName
string genericName()

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

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.

removeGroup
void removeGroup(string groupName)

Removes group by name.

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. xterm is used by default, if could not determine other terminal emulator. Note: This function does not 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, then the 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 into the range.

Inherited Members

From IniLikeFile

ReadOptions
enum ReadOptions

Flags to manage .ini like file reading

loadFromFile
IniLikeFile loadFromFile(string fileName, ReadOptions options)

Reads desktop file from file.

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

Reads desktop file from string.

group
inout(IniLikeGroup) group(string groupName)
addGroup
IniLikeGroup addGroup(string groupName)

Creates new group usin groupName.

removeGroup
void removeGroup(string groupName)

Removes group by name.

byGroup
auto byGroup()

Range of groups in order how they were defined in file.

saveToFile
void saveToFile(string fileName)

Saves object to file using .ini like format.

saveToString
string saveToString()

Saves object to string using .ini like format.

fileName
string fileName()
firstComments
auto firstComments()
Undocumented in source. Be warned that the author may not have intended to support it.
addFirstComment
void addFirstComment(string line)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta