Gnomecustommenus

This page is dedicated to crafting custom XDG-based submenus in GUIs like Gnome. There might be more elegant ways to do this, but this is how we have learned how to do it, and it seems to work well.

One example:

  • Open a shell, su to root (or prepend 'sudo' to all below commands) and navigate to /etc/xdg/menus
  • Edit applications.menu and insert code to create a new submenu:

applications.menu:

<!-- Custom submenu -->
  <Menu>
    <Name>Blah</Name>
    <Directory>blah.directory</Directory>
    <Include>
      <And>
        <Category>blah</Category>
        <Not>
          <Category>Settings</Category>
        </Not>
      </And>
    </Include>
  </Menu> <!-- End Custom submenu -->
  • Navigate to /usr/share/applications (this is where your .desktop files are, which are files that describe individual menu entries)
  • Create a new entry, for example:

xeyes.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=XEyes
GenericName=XEyes
Comment=Start XEyes, the best X application ever.
Exec=xeyes
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=
Categories=Application;Blah;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png
StartupWMClass=Firefox-bin
StartupNotify=true

NOTE: Pay special attention to your category name, it must be identical in the menu entry files as well as the .desktop files.

Relevant URLs:

Gnome System Administrator's Guide - Customizing Menus

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License