Wednesday, May 24, 2006

Basic .desktop file format

The .desktop files are the basic entities that are used to build the desktop and the menu in freedesktop.org specification. These are plain text files with "group" headers of the form [GROUP_NAME], where delimiters [ and ] obviusly cannot be contained within GROUP_NAME, and pairs of keys and values with different meanings and restrictions that we'll see in another posts. All the pairs found right after a group header belongs to this group, so pairs are categorized in each desktop entry. Every valid .desktop file must start with the same group, namely [Desktop Entry]. The specification includes also classical bash-style comments (lines starting with #) that are to be ignored by implementations. Specs also indicate that implementations must ignore and preserve items they can't handle, wich gives us the posibility of adding some homegrown properties for the files (Z-Depth, DefaultIconAnimation...), we'll see later on. Each key/value, so called entry, in the file should have the format: Key=Value With spaces trimmed from the beginning and the end of the Key and the Value, and using = as delimiter (can't be used inside a key/value). There are some escape sequences supported in the entries: \s (space), \n (newline), \t (tabulator), \r (carriage return) and \\ (backslash). Some keys can have multiple values that should be separated by a semicolon, and ended by one ; also. To put a semicolon in a single value it has to be escaped \; . Value types are constrained to : string, localestring, regexp, boolean (true/false) and numeric values, from which the strings are ASCII characters and localestring are UTF-8 encoded values (except if something called Legacy-Mixed Encoding is enabled, but we'll talk about it in another post). Later more

0 Comments:

Post a Comment

<< Home