Xfce Wiki

Sub domains

This is an old revision of the document!

自定义 Xfce 菜单

此页介绍如何在4.5或更高版本 Xfdesktop 上自定义菜单。对于早期版本,您可以使用 libxfce4menu 的 GUI。

GNU 许可的 LXDE 的图形菜单编辑器 LXMenuEditor ,从 Xfce 4.8.0和LXMenuEditor 20110523 起,它也可以用于 XFCE 了。

xfdesktop 会安装什么文件

Xfdesktop 会安装菜单文件和 .desktop 文件以及一些定义菜单的非 xfdesktop 的 .desktop 文件。自定义菜单就需要修改这些文件。这里描述修改的菜单文件由环境变量 $XDG_CONFIG_HOME 确定(通常为空,所以是 ~/.config/menus/xfce-applications.menu)和一些你的主目录中 .desktop 文件。


当 xfdesktop 会话启动时,如果菜单文件的目录存在,修改立即生效。同样地,当 xfdesktop 会话启动时,如果你主目录中的 .local/share/applications 目录存在的话,对 .desktop 文件的修改也立即生效。

Copy the menu file

This is only necessary if you want to change the hardcoded entries (usually above the Settings sub-menu and below the last sub-menu) or to change the sub-menu definitions.

Create ~/.config/menus directory (if it doesn't exist already):

mkdir ${XDG_CONFIG_HOME:-~/.config}/menus/

Copy the installed menu file to where xfdesktop will look for it before looking for the installed menu file ($prefix = /usr on most systems):

cp $prefix/etc/xdg/menus/xfce-applications.menu ${XDG_CONFIG_HOME:-~/.config}/menus


cp $prefix/etc/xfce/xdg/menus/xfce-applications.menu ${XDG_CONFIG_HOME:-~/.config}/menus

Copy a .desktop file

For example, to copy the Web Browser's .desktop file to the .local/share/applications directory in your home directory ($prefix = /usr on most systems):

cp $prefix/share/applications/xfce4-web-browser.desktop ~/.local/share/applications 


cp /usr/share/applications/xfce4-web-browser.desktop ~/.local/share/applications

Hide menu entries

If you want to hide menu entries from all menus, copy their .desktop files and edit them to add a NoDisplay=true line.

As explainedhere, NoDisplay=true will hide the application from the menu but the mime type associations will still be available. Hidden=true is equivalent to deleting the file.

Hide only root entries

If you only want to remove menu items from the root menu only, copy their .desktop files and edit them to remove Category X-Xfce-Toplevel.

Xfdesktop installs the following desktop entry files in the root menu ($prefix = /usr on most systems):

  • $prefix/share/applications/xfce4-about-xfce.desktop
  • $prefix/share/applications/xfce4-file-manager.desktop
  • $prefix/share/applications/xfce4-help.desktop
  • $prefix/share/applications/xfce4-logout.desktop
  • $prefix/share/applications/xfce4-run-program.desktop
  • $prefix/share/applications/xfce4-terminal.desktop
  • $prefix/share/applications/xfce4-web-browser.desktop

For example, to remove Web Browser from the root menu, copy its .desktop file and edit it, changing Categories=X-XFCE;X-Xfce-Toplevel; to Categories=X-XFCE;

Add entries

Create a .desktop file for each entry required. For example, a menu entry for Eclipse, create a file named eclipse.desktop in ~/.local/share/applications:

[Desktop Entry]
Comment=Eclipse Java IDE

If you prefer to work in a GUI (allows browsing for the icon) you can create the .desktop file using

exo-desktop-item-edit --create-new ~/.local/share/applications

but the new file will only have category Application so will probably need editing afterwards.

The categories determine where the new entry will be displayed. For display in the root menu, include category X-Xfce-Toplevel. For display in a sub-menu, include at least one of the categories defined for that sub-menu. These can be found by examining your ${XDG_CONFIG_HOME:-~/.config}/menus/xfce-applications.menu. For example here's an Accessories sub-menu definition:


Any .desktop files with categories including Accessibility, Core, Legacy or Utility will be shown in the Accessories sub-menu providing they do not also have NoDisplay=true.

The Other sub-menu

If there are any .desktop files which are configured to be displayed in the xfdesktop menu but do not have any categories which include them in any of the defined menus, the Other sub-menu will be displayed and will display those entries. This applies to .desktop files in the $prefix/share/applications/ directory as well as the ~/.local/share/applications directory.

If you have an Other sub-menu and do not want it, copy the .desktop file and modify its categories so it is included in one of the other sub-menus.

Create sub-menus

To create a new sub-menu, add a new “Menu” element to your ~/.config/menus/xfce-applications.menu at the same level as the other xfdesktop sub-menus like “Graphics” or “Multimedia”. In addition to the aptly named “Name” element, two additional elements are required: first, the “Directory” element is useful to associate the submenu with a desktop entry file which provides, among others, an appropriate icon as we will see shortly. Second, the “Category” element associates .desktop files with this sub-menu. It is recommended to make up a custom category starting with “X-”, which is the prefix of non-standard categories by convention. As an example, we'll create a submenu with entries to display various folders in your favourite file manager. Your new entry should look like this:


Next, create ~/.local/share/desktop-directories/folders.directory with the following contents:

[Desktop Entry]
Comment=Folders viewed in a file manager

This provides the displayed name of the subdirectory as well as an appropriate icon.

Finally, create .desktop files in your ~/.local/share/applications folder as shown above to populate the submenu. In order to be displayed in the submenu, add your custom category to the “Categories” list. One of these files, let's call it thunar-home.desktop, might look like this:

[Desktop Entry]
Exec=/usr/local/bin/thunar /usr/home/yourname
Comment=home displayed in Thunar

With all this in place, you should have a new submenu called “Folders” using the file manager icon. The submenu entry shown above should display your home directory in Thunar. You can of course add more entries as shortcuts to common places like /cdrom, /stick, /, or whatever you see fit.

Forcing changes

This is not usually necessary and may not work anyway; logging out of the Xfce session and back in always works.

If the menu is not automatically updated with your changes, try

xfdesktop --reload

If that doesn't work, try

killall -HUP xfdesktop



Question: I setup several machines for my company. After migrating all the software to the new version 9.04 we realized we cannot use the custom menus that points to our software with specific variables. Answer: In Jaunty the appropriate file might be found in /etc/xdg/xubuntu/menus/xfce-applications.menu and not in /etc/xdg/menus/xfce-applications.menu. Everything else should work as described above. Could be any other *buntu-flavor in the path also, I have no appropriate machine to compare. Also note that you should not only extend your Layout-Section but also your Include-Section …

Question: Primarily i wanted to modify the menu-structure. Just copying xfce-applications.menu to my home didn't do it. After tracing around with strace and inotify i finally logged out of xfce and back in. Before that my local copy didnt even get touched. xfdesktop –reload didn't work either. Modifying menu entries was ok but changes to the structure of the menu file had no effect. Answer: Menu file changes are implemented immediately if the menu file's directory exists when the xfdesktop session starts. Any further changes you made after logging out of the Xfce session and back in again should have been reflected in the menu immediately.

Question: I want to add an entry for an application that's installed by hand, rather than through the package manager. If I make a local copy of /etc/xdg/xubuntu/menus/xfce-applications.menu, then when I add a further application using the package manager, won't it change only the master? Will I have to re-copy and re-edit? Answer: No. The menu file defines which categories of entry go where. Your further application will appear in the defined place(s). If not, compare its categories with the categories in the menu file and adjust accordingly. Another possible gotcha is that the .desktop file has an OnlyShowIn or NotShowIn line that does not match Xfce.


  • What do i do, if the above does not work? (only xfce's own desktop files are seen, not even the one created with exo-desktop-item-edit, not to speak from common desktop files in both /usr/share/applications/ and ~/.local/share/applications/)
  • Where do i find a log or anything like that, actually giving me a clue other than simply empty space in the menu?
  • I run Jaunty and need to make the menu to be multi-level, which, in previous versions I believe, could be achieved by editing '/etc/X11/xdg/xfce4/desktop/menu.xml' and replace style=“simple” with style=“multilevel” in the <include>. How do I do this in Jaunty? I need this because I have certain applications under Wine which have very many start-menu entries and they are all merged into one menulevel, which is really annoying to navigate thru. Please help …