Xfce desktop file

i have 2 apps that i want to add to my menu
when i write them with this format

[Desktop Entry] Version=1.0 Type=Application Name= Exec= Icon=

Categories=

the menu only shows the second one [ i think it’s overwriting the values]
how can i fix this ?

Hello @Null_Nerd

You can do it like this:

[Desktop Entry] Version=1.0 Type=Application Name= Exec= Path= Icon= Categories= Actions=First;Second; [Desktop Action First] Name= Exec= Path= [Desktop Action Second] Name= Exec= Path=

//specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

1 Like

@megavolt i writed it like this and it doesn’t show any of the applications [Desktop Entry] Version=1.0 Type=Application Name=Alacritty Exec=Path Icon=Path

Actions=First;

[Desktop Action First] Name=Name Exec=Path

Icon=Path

does it require a restart ? [when i added only one of them the menu changed right away ]

Maybe you need to run:

sudo update-desktop-database /usr/share/applications

Well, change the path if it is somewhere else.

1 Like

The databases in [/home/user/.local/share/applications/.desktop] could not be updated.
i found out that the first app is in the menu but not the second one .

Null_Nerd:

/home/user/.local/share/applications/.desktop

I hope the name is really not .desktop, but have a name like firefox.desktop

“Actions” are rather a “submenu” of the desktop file. Should be visible by right-clicking.

1 Like

thanks now i see it is there any way that i can add the second one to the actual menu ?

Create a second desktop file?!

1 Like

i thought every thing should be in 1 file


thanks for the support .

1 Like

Null_Nerd:

2 apps that i want to add to my menu

In addition to manually creating a desktop file, you can also do:

  1. Right-click the XFCE desktop and select “Create Launcher”

  2. Or, right-click the Whisker Menu and select “Edit Applications” a. On the toolbar click the plus-sign and select “Add Launcher”, fill in the rest as needed.

    b. On the toolbar there is also a “Save Launcher”, “Test Launcher” and “Delete Launcher”.

With option 1 or 2 above, if you want to see where the file was stored [so you can view it or move it], on the command line type find $HOME newermt "1 minute ago". Change the time span as needed.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

I am running Debian 9 [stretch] and XFCE. I am creating a desktop file so I can launch Mozilla Thunderbird from the Whisker menu. I would like Thunderbird to have the right value for its Categories attribute. I generated a list of categories using the following command. An example of the command's output also follows.

cd /usr/share/applications grep -i -P -e "^[Cc]ategories[=].*" ./*.desktop | sort | uniq

List of Categories

However, the list I generated might not be complete. I have read other questions including:

Where can I find a complete and canonical list of categories?

Here is the desktop file I created.

[Desktop Entry] Version=1.0 Name=Thunderbird GenericName=Thunderbird mail client Comment=Check email using a local Thunderbird mail client Exec=/opt/thunderbird/thunderbird %F Icon=/home/username/Pictures/Icons/thunderbird-256.png Terminal=false Type=Application Categories=Network;Office;Email; MimeType=message/rfc822;message/x-gnu-rmail; X-XFCE-MimeType=x-scheme-handler/mailto;

Both the KDE and GNOME desktop environments have adopted a similar format for "desktop entries", or configuration files describing how a particular program is to be launched, how it appears in menus, etc. It is to the larger community's benefit that a unified standard be agreed upon by all parties such that interoperation between the two environments, and indeed any additional environments that implement the specification, becomes simpler.

Desktop entry files should have the .desktop extension, except for files of Type Directory which should have the .directory extension. Determining file type on basis of extension makes determining the file type very easy and quick. When no file extension is present, the desktop system should fall back to recognition via "magic detection".

For applications, the part of the name of the desktop file before the .desktop extension should be a valid D-Bus well-known name. This means that it is a sequence of non-empty elements separated by dots [U+002E FULL STOP], none of which starts with a digit, and each of which contains only characters from the set [A-Za-z0-9-_]: ASCII letters, digits, dash [U+002D HYPHEN-MINUS] and underscore [U+005F LOW LINE].

The name of the desktop entry should follow the "reverse DNS" convention: it should start with a reversed DNS domain name controlled by the author of the application, in lower case. The domain name should be followed by the name of the application, which is conventionally written with words run together and initial capital letters [CamelCase]. For example, if the owner of example.org writes "Foo Viewer", they might choose the name org.example.FooViewer, resulting in a file named org.example.FooViewer.desktop.

Well-known names containing the dash are allowed but not recommended, because the dash is not allowed in some related uses of reversed DNS names, such as D-Bus object paths and interface names, and Flatpak app IDs. If the author's domain name contains a dash, replacing it with an underscore is recommended: this cannot cause ambiguity, because underscores are not allowed in DNS domain names.

If the author's domain name contains a label starting with a digit, [which is not allowed in D-Bus well-known names], prepending an underscore to that element of the desktop entry name is recommended. For example, 7-zip.org might release an application named org._7_zip.Archiver.

Each desktop entry representing an application is identified by its desktop file ID, which is based on its filename.

To determine the ID of a desktop file, make its full path relative to the $XDG_DATA_DIRS component in which the desktop file is installed, remove the "applications/" prefix, and turn '/' into '-'.

For example /usr/share/applications/foo/bar.desktop has the desktop file ID foo-bar.desktop.

If multiple files have the same desktop file ID, the first one in the $XDG_DATA_DIRS precedence order is used.

For example, if $XDG_DATA_DIRS contains the default paths /usr/local/share:/usr/share, then /usr/local/share/applications/org.foo.bar.desktop and /usr/share/applications/org.foo.bar.desktop both have the same desktop file ID org.foo.bar.desktop, but only the first one will be used.

If both foo-bar.desktop and foo/bar.desktop exist, it is undefined which is selected.

If the desktop file is not installed in an applications subdirectory of one of the $XDG_DATA_DIRS components, it does not have an ID.

Desktop entry files are encoded in UTF-8. A file is interpreted as a series of lines that are separated by linefeed characters. Case is significant everywhere in the file.

Compliant implementations MUST not remove any fields from the file, even if they don't support them. Such fields must be maintained in a list somewhere, and if the file is "rewritten", they will be included. This ensures that any desktop-specific extensions will be preserved even if another system accesses and changes the file.

Lines beginning with a # and blank lines are considered comments and will be ignored, however they should be preserved across reads and writes of the desktop entry file.

Comment lines are uninterpreted and may contain any character [except for LF]. However, using UTF-8 for comment lines that contain characters not in ASCII is encouraged.

A group header with name groupname is a line in the format:

[groupname]

Group names may contain all ASCII characters except for [ and ] and control characters.

Multiple groups may not have the same name.

All {key,value} pairs following a group header until a new group header belong to the group.

The basic format of the desktop entry file requires that there be a group header named Desktop Entry. There may be other groups present in the file, but this is the most important group which explicitly needs to be supported. This group should also be used as the "magic key" for automatic MIME type detection. There should be nothing preceding this group in the desktop entry file but possibly one or more comments.

Entries in the file are {key,value} pairs in the format:

Key=Value

Space before and after the equals sign should be ignored; the = sign is the actual delimiter.

Only the characters A-Za-z0-9- may be used in key names.

As the case is significant, the keys Name and NAME are not equivalent.

Multiple keys in the same group may not have the same name. Keys in different groups may have the same name.

The value types recognized are string, localestring, iconstring, boolean, and numeric.

  • Values of type string may contain all ASCII characters except for control characters.

  • Values of type localestring are user displayable, and are encoded in UTF-8.

  • Values of type iconstring are the names of icons; these may be absolute paths, or symbolic names for icons located using the algorithm described in the Icon Theme Specification. Such values are not user-displayable, and are encoded in UTF-8.

  • Values of type boolean must either be the string true or false.

  • Values of type numeric must be a valid floating point number as recognized by the %f specifier for scanf in the C locale.

The escape sequences \s, \n, \t, \r, and \\ are supported for values of type string, localestring and iconstring, meaning ASCII space, newline, tab, carriage return, and backslash, respectively.

Some keys can have multiple values. In such a case, the value of the key is specified as a plural: for example, string[s]. The multiple values should be separated by a semicolon and the value of the key may be optionally terminated by a semicolon. Trailing empty strings must always be terminated with a semicolon. Semicolons in these values need to be escaped using \;.

Localized values for keys

Keys with type localestring and iconstring may be postfixed by [LOCALE], where LOCALE is the locale type of the entry. LOCALE must be of the form lang_COUNTRY.ENCODING@MODIFIER, where _COUNTRY, .ENCODING, and @MODIFIER may be omitted. If a postfixed key occurs, the same key must be also present without the postfix.

When reading in the desktop entry file, the value of the key is selected by matching the current POSIX locale for the LC_MESSAGES category against the LOCALE postfixes of all occurrences of the key, with the .ENCODING part stripped.

The matching is done as follows. If LC_MESSAGES is of the form lang_COUNTRY.ENCODING@MODIFIER, then it will match a key of the form lang_COUNTRY@MODIFIER. If such a key does not exist, it will attempt to match lang_COUNTRY followed by lang@MODIFIER. Then, a match against lang by itself will be attempted. Finally, if no matching key is found the required key without a locale specified is used. The encoding from the LC_MESSAGES value is ignored when matching.

If LC_MESSAGES does not have a MODIFIER field, then no key with a modifier will be matched. Similarly, if LC_MESSAGES does not have a COUNTRY field, then no key with a country specified will be matched. If LC_MESSAGES just has a lang field, then it will do a straight match to a key with a similar value. The following table lists possible matches of various LC_MESSAGES values in the order in which they are matched. Note that the ENCODING field isn't shown.

Table 1. Locale Matching

LC_MESSAGES valuePossible keys in order of matching
lang_COUNTRY@MODIFIER lang_COUNTRY@MODIFIER, lang_COUNTRY, lang@MODIFIER, lang, default value
lang_COUNTRY lang_COUNTRY, lang, default value
lang@MODIFIER lang@MODIFIER, lang, default value
lang lang, default value


For example, if the current value of the LC_MESSAGES category is sr_YU@Latn and the desktop file includes:

Name=Foo Name[sr_YU]=... Name[sr@Latn]=... Name[sr]=...

then the value of the Name keyed by sr_YU is used.

Although icon names of type iconstring are localizable, they are not human-readable strings, so should typically not be handled by translation tools. Most applications are not expected to localize their icons; exceptions might include icons containing text or culture-specific symbology.

Recognized desktop entry keys

Keys are either OPTIONAL or REQUIRED. If a key is OPTIONAL it may or may not be present in the file. However, if it isn't, the implementation of the standard should not blow up, it must provide some sane defaults.

Some keys only make sense in the context when another particular key is also present and set to a specific value. Those keys should not be used if the particular key is not present or not set to the specific value. For example, the Terminal key can only be used when the value of the Type key is Application.

If a REQUIRED key is only valid in the context of another key set to a specific value, then it has to be present only if the other key is set to the specific value. For example, the URL key has to be present when and only when when the value of the Type key is Link.

Some example keys: Name[C], Comment[it].

Table 2. Standard Keys

KeyDescriptionValue TypeREQ?Type
Type This specification defines 3 types of desktop entries: Application [type 1], Link [type 2] and Directory [type 3]. To allow the addition of new types in the future, implementations should ignore desktop entries with an unknown type. stringYES 
Version Version of the Desktop Entry Specification that the desktop entry conforms with. Entries that confirm with this version of the specification should use 1.5. Note that the version field is not required to be present. stringNO1-3
Name Specific name of the application, for example "Mozilla". localestringYES1-3
GenericName Generic name of the application, for example "Web Browser". localestringNO1-3
NoDisplay NoDisplay means "this application exists, but don't display it in the menus". This can be useful to e.g. associate this application with MIME types, so that it gets launched from a file manager [or other apps], without having a menu entry for it [there are tons of good reasons for this, including e.g. the netscape -remote, or kfmclient openURL kind of stuff]. booleanNO1-3
Comment Tooltip for the entry, for example "View sites on the Internet". The value should not be redundant with the values of Name and GenericName. localestringNO1-3
Icon Icon to display in file manager, menus, etc. If the name is an absolute path, the given file will be used. If the name is not an absolute path, the algorithm described in the Icon Theme Specification will be used to locate the icon. iconstringNO1-3
Hidden Hidden should have been called Deleted. It means the user deleted [at his level] something that was present [at an upper level, e.g. in the system dirs]. It's strictly equivalent to the .desktop file not existing at all, as far as that user is concerned. This can also be used to "uninstall" existing files [e.g. due to a renaming] - by letting make install install a file with Hidden=true in it. booleanNO1-3
OnlyShowIn, NotShowIn

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

By default, a desktop file should be shown, unless an OnlyShowIn key is present, in which case, the default is for the file not to be shown.

If $XDG_CURRENT_DESKTOP is set then it contains a colon-separated list of strings. In order, each string is considered. If a matching entry is found in OnlyShowIn then the desktop file is shown. If an entry is found in NotShowIn then the desktop file is not shown. If none of the strings match then the default action is taken [as above].

$XDG_CURRENT_DESKTOP should have been set by the login manager, according to the value of the DesktopNames found in the session file. The entry in the session file has multiple values separated in the usual way: with a semicolon.

The same desktop name may not appear in both OnlyShowIn and NotShowIn of a group.

string[s]NO1-3
DBusActivatable A boolean value specifying if D-Bus activation is supported for this application. If this key is missing, the default value is false. If the value is true then implementations should ignore the Exec key and send a D-Bus message to launch the application. See D-Bus Activation for more information on how this works. Applications should still include Exec= lines in their desktop files for compatibility with implementations that do not understand the DBusActivatable key. booleanNO 
TryExec Path to an executable file on disk used to determine if the program is actually installed. If the path is not an absolute path, the file is looked up in the $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]. stringNO1
Exec Program to execute, possibly with arguments. See the Exec key for details on how this key works. The Exec key is required if DBusActivatable is not set to true. Even if DBusActivatable is true, Exec should be specified for compatibility with implementations that do not understand DBusActivatable. stringNO1
Path If entry is of type Application, the working directory to run the program in. stringNO1
Terminal Whether the program runs in a terminal window. booleanNO1
Actions Identifiers for application actions. This can be used to tell the application to make a specific action, different from the default behavior. The Application actions section describes how actions work. string[s]NO1
MimeType The MIME type[s] supported by this application. string[s]NO1
Categories Categories in which the entry should be shown in a menu [for possible values see the Desktop Menu Specification]. string[s]NO1
Implements A list of interfaces that this application implements. By default, a desktop file implements no interfaces. See Interfaces for more information on how this works. string[s]NO 
Keywords A list of strings which may be used in addition to other metadata to describe this entry. This can be useful e.g. to facilitate searching through entries. The values are not meant for display, and should not be redundant with the values of Name or GenericName. localestring[s]NO1
StartupNotify If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_STARTUP_ID environment variable set. If false, it is KNOWN that the application does not work with startup notification at all [does not shown any window, breaks even when using StartupWMClass, etc.]. If absent, a reasonable handling is up to implementations [assuming false, using StartupWMClass, etc.]. [See the Startup Notification Protocol Specification for more details]. booleanNO1
StartupWMClass If specified, it is known that the application will map at least one window with the given string as its WM class or WM name hint [see the Startup Notification Protocol Specification for more details]. stringNO1
URL If entry is Link type, the URL to access. stringYES2
PrefersNonDefaultGPU If true, the application prefers to be run on a more powerful discrete GPU if available, which we describe as “a GPU other than the default one” in this spec to avoid the need to define what a discrete GPU is and in which cases it might be considered more powerful than the default GPU. This key is only a hint and support might not be present depending on the implementation. booleanNO1
SingleMainWindow If true, the application has a single main window, and does not support having an additional one opened. This key is used to signal to the implementation to avoid offering a UI to launch another window of the app. This key is only a hint and support might not be present depending on the implementation. booleanNO1


The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment. The name or path of the executable program may not contain the equal sign ["="]. Arguments are separated by a space.

Arguments may be quoted in whole. If an argument contains a reserved character the argument must be quoted. The rules for quoting of arguments is also applicable to the executable name or path of the executable program as provided.

Quoting must be done by enclosing the argument between double quotes and escaping the double quote character, backtick character ["`"], dollar sign ["$"] and backslash character ["\"] by preceding it with an additional backslash character. Implementations must undo quoting before expanding field codes and before passing the argument to the executable program. Reserved characters are space [" "], tab, newline, double quote, single quote ["'"], backslash character ["\"], greater-than sign [">"], less-than sign ["

Chủ Đề