Last Updated: February 25, 2016
·
4.128K
· Jason Balthis

Custom Gnome3 Menu Items & App Launchers

Have you ever wanted a simple means of starting up a new application or program that you have just compiled, installed, or by some means localized onto your *nix system running Gnome3 for a window manager only to discover that there is no predefined way of adding an icon/link to the menu?

Well gentle reader, you are in luck, as there really isn't a whole lot to the coding of custom menu items up for yourself.

First off, a little background information is necessary. Gnome3 uses what are called 'Desktop Entry' files to store information about particular items that are executable from the desktop or its menu system. These file end in '.desktop' and are typically stored in /usr/share/applications.

Figure 1:

/usr/share/applications    ## Where the executable links are stored
/usr/share/pixmaps         ## Where the icons can be found

Also, the /usr/share/pixmaps directory is a really good start on locating the icons for use in the menu or within Gnome3 in general.

After locating an icon and deciding on what to call your application, the next step is writing all of these attributes out in a .desktop file such as the following basic, yet functional example illustrates:

Figure 2:

[Desktop Entry]
Name=Root File Browser
Comment=Access and organize files with elevated permissions
Keywords=folder;manager;explore;disk;filesystem;root;
Exec=sudo nautilus --new-window %U
Icon=system-file-manager
Terminal=false
Type=Application
StartupNotify=true
OnlyShowIn=GNOME;Unity;
Categories=GNOME;GTK;System;Core;FileManager;
MimeType=inode/directory;application/x-gnome-saved-search;

The code from figure 2 simply supplies Gnome3 with the information relevant to the application in order for it to be displayed properly and in keeping in theme with thte other applications, as well as the executable string, which in this case is a call to nautilus with elevated privledges, and various other attributes that can be filled in to customize your window manager's behaviour toward the new menu item even more.

In closing, creating custom menu-item launchers for your own applications in Gnome3 is no sweat at all. This basic outline can be used to expand on greatly, creating an infinitely more customizable user experience.