Xfce application menu config

04 June 2025
The windowing manager installed on my company laptop is Xfce themes to look like WindowsXP and one of my preferences is to have a small selection of hand-picked programs at the top level of the applications menu, with the stock menu hierarchy that is here by default instead confined to a sub-directory. However one long-standing issue is the implementation of this which dates back to at least the earlier part of 2019 being a hackish bodge that got copied between various workstations since. As part of trying out the latest Slackware Current which is the developmental branch of Slackware Linux decided to have a go reimplementing my Xfce theming from scratch including doing a proper job of the menu.

Menu image

The Xfce menu file

If the XML file xfce-applications.menu exists within ~/.config/menus/ it automatically gets unsed in preference to the system-wide one within /etc/xdg/menus/ and the snippet below shows the changes made to a copy placed into the home-directory location. Note that this is in turn overridden if a menu file is explicitly referenced from the application menu preferences, and confusingly as menu editor utilities are hard-coded to use the one under ~/.config. Note that the .desktop files corresponding to the applications are included twice — explicitly listing them under <Include> means there is no need to any overriding via adding X-Xfce-Toplevel as a category.

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd"> <Menu> <Name>Xfce</Name> <DefaultAppDirs/> <DefaultDirectoryDirs/> <Include> <Category>X-Xfce-Toplevel</Category> <Filename>firefox.desktop</Filename> <Filename>thunderbird.desktop</Filename> <Filename>SciTE.desktop</Filename> <Filename>gvim.desktop</Filename> <Filename>org.pulseaudio.pavucontrol.desktop</Filename> </Include> <Layout> <Filename>xfce4-about.desktop</Filename> <Separator/> <Filename>firefox.desktop</Filename> <Filename>thunderbird.desktop</Filename> <Filename>SciTE.desktop</Filename> <Filename>gvim.desktop</Filename> <Filename>org.pulseaudio.pavucontrol.desktop</Filename> <Separator/> <Menuname>Settings</Menuname> <Menuname>Stock</Menuname> <Separator/> <Filename>xfce4-run.desktop</Filename> <Filename>xfce4-session-logout.desktop</Filename> </Layout> <Menu> <Name>Settings</Name> <!-- Unchanged content omitted --> </Menu> <Menu> <Name>Stock</Name> <Directory>stock.directory</Directory> <Menu> <Name>Accessories</Name> <!-- Unchanged content omitted --> </Menu> <!-- Other menus omitted --> <Menu> <Name>Other</Name> <!-- Unchanged content omitted --> </Menu> </Menu> <DefaultMergeDirs/> </Menu>

The full file can be downloaded.

Desktop and directory files

If an application does not have a corresponding .desktop file within /usr/share/applications/ or there is a need to override one that is there, it can be placed into ~/.local/share/applications/ and the snippet below shows one created for a password-emitting shell script I happen to run a lot while in the office. Using Exec=/bin/bash -c is a work-around to enable resolution of the home directory path.

[Desktop Entry] Type=Application Encoding=UTF-8 Name=LDAP Password Exec=/bin/bash -c "${HOME}/bin/type-ldap-passwd.sh" Icon=stock_keyring.png Terminal=false Categories=X-Xfce-Toplevel

Menus have an equivilent .directory files with the new Stock Programs making reference to stock.directory and such a file within ~/.local/share/desktop-directories/ with the following content. As with desktop files it specifies the menu name and the icon to use plus some other meta-data which is not really of much practical use.

[Desktop Entry] Version=1.1 Type=Directory Name=Stock Programs Comment= Icon=folder

Xfce menu editors

There are various utilities out there for the editing of Xfce application menus but they are basically more trouble than they are worth, such as not having drag-and-drop and the inability to nest items without deleting and recreating them. I had to manually change Alacarte because it made reference to Python package collections which has since had Sequence moved into collections.abc, and while MenuLibre was the best of a bad bunch it expanded out the menu configuration file so it was almost useless even in providing a starting point.

Remarks

This is a clean-up I knew needed doing from day one and since then it had only got messier having been copied between workstation deployments. However for now I am holding back from applying it to my current professional workstation because the latter uses Ubuntu rather than Slackware and hence will likely need a few more tweaks, as well as wanting to avoid potential down-time of pulling over other program settings. It is the sort of thing to do as part of an all-up system refresh which I can foresee happening within less than a year.