I want to create an application menu in Xfce that contains no submenus, rather just contains application launchers for all .desktop files in the virtualization category. If you are uncertain as to what I am referring to, please refer to the screenshot below.

enter image description here

In this screenshot, if I had my way, there would be no virtualization submenu, rather "Arch Linux", "CentOS 7-1511", "Debian 8.2", etc. and all the other .desktop files for these VMs would be placed in the Virtualization application menu directly. I have written custom .menu files before, and I have tried:

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"

  <!-- Read standard .directory and .desktop file locations -->

  <!-- Read in overrides and child menus from applications-merged/ -->
  <!-- Virtualization Software-->

    <Merge type="menus"/>


but it gave me an empty virtualization application menu.


For the applications' shortcuts to be found, the .desktop files must be located in one of default directories, such as ~/.local/share/applications for current user or /usr/share/applications for all users.

If you are unsure what went wrong in your case, check out my working example tested in Xubuntu 14.04 (Xfce 4.10) as below.

Example setup

The following setup assumes that:

  • the shortcuts (.desktop files) have been created and include at least one category, which could be existent (i.e. "System") or non-existent (i.e. "Custom", "Virtual");
  • the shortcuts have been moved to the shared or local directory i.e. ~/.local/share/applications;
  • the menu (.menu file) have been created such that the shortcuts from particular defined category is included (i.e. "Virtual");
  • the menu is placed somewhere appropriate i.e. ~/.config/menus directory

The .menu file contains the following.

<?xml version="1.0" encoding="UTF-8" ?>
  PUBLIC '-//freedesktop//DTD Menu 1.0//EN'
    <!--This defines where to find .desktop files-->
    <DefaultAppDirs />
    <!--This affects what entries will appear under "Parent"-->
    <!--This includes what entries will appear under "Child" -->
    <!--This affects how will the entries appear under "Parent"-->

In this example, I have only created one custom shortcut named vm-test.desktop that will appear under "Parent" menu. The other .desktop files are already existing in ~/.local/share/applications and /usr/share/applications directories. I had included these on purpose, to show it works in both ways.

Example screenshots

Add "Application Menu" applet to the Xfce panel, and select "Use custom menu file" and load the .menu file from the share or local directory. Finally, click on the menu applet to see the shortcuts.

Xfce menu applet properties

Xfce menu applet demo

Discovering shortcuts

The shortcuts that have been added to ~/.local/share/applications directory will also be found automatically by Whisker Menu or Applications Menu applet (using default .menu file).

The .desktop files, which specify non-existent category or do not specify any category, will appear under "Other" category. If it has several or more categories, it will appear in the existent category only i.e. "System" and does not appear under "Other".

To understand this, see the content of .desktop file I have used in example above.

[Desktop Entry]
Name=VirtualBox VM test
Comment=Run "test" VM in VirtualBox
Exec=virtualbox --startvm "test"
Name[en_US]=VirtualBox VM test
GenericName=VM test

As such, the custom shortcut will appear under "System" category in Application Menu based on the specified categories. Additionally, because it has specified "Virtual" category, the custom .menu file can easily include any .desktop files that have "Virtual" category.

Additional notes

In Debian, there were no .desktop files by default in ~/.local/share/applications and ~/.config/menus directory does not exist (need to create this manually).

Tested working in Xubuntu 14.04 (Xfce 4.10) and Debian 8.3 Xfce (Xfce 4.10) 32-bit systems.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.