How to add an entry to the "Red Hat" Menu

In Red Hat 9 (and UBLinux 2), the contents of the Red Hat menu is built from numerous ".desktop" files contained within the directory /usr/share/applications . Whenever something is added or changed within this directory, the menu is rebuilt on-the-fly. It is therefor possible to have an RPM add an item to the Red Hat menu and have it appear immediately.

The contents of the mulberry.desktop file is as follows:

[Desktop Entry]
Encoding=UTF-8
Name=Mulberry
Comment=Graphical E-Mail Client
Exec=/usr/local/bin/mulberry
Icon=mulberry.png
Terminal=false
Type=Application
Categories=Application;Network;X-Red-Hat-Base;

The Name field is what will be displayed in the menu.

The Comment will be displayed when someone hovers their mouse over the icon.

Exec indicates what to execute when the icon is clicked on.

Icon indicates the file within /usr/share/pixmaps which should be used. We always want to make sure our icons are 48x48 pixels in the event that they will be placed in the panel next to the Red Hat menu, in addition to inside the menu itself.

Terminal=false indicates that the program should not be run within a terminal window, and Type indicates that this is an application we're launching.

The Categories section indicates where in the menu the icon should be placed. In this case, "Application;Network;X-Red-Hat-Base;" indicates that the icon for Mulberry should be placed within the main Internet group of the Red Hat Menu.

A note on Icons:

Most icons will have their own background color, which most likely won't match the background color of the menu itself. It is fairly easy to edit these icons so that their background is transparent. To do so:

  1. Open The GIMP (RH Menu - Graphics - The GIMP)
  2. Open the file in question (in the case of Mulberry, /usr/share/pixmaps/mulberry.png)
  3. Right click on the image - Select - By color.
  4. In the image, click on the background color. Then in the 'By Color Section' window, click on the invert button, then the close button.
  5. Everything in the image which is not the icon's background color should now be selected. Right click on the image, go to Edit - Copy.
  6. Click on the File menu - New.
  7. Width and Height of the image should each be 48 pixels.
  8. In the 'Fill Type' section, select Transparent, then click OK.
  9. Right click on the new image, go to Edit - Paste. You should now see the icon itself on a grey checkerboard background. Save the file to a directory of your choice (as a png file) and then move the file into the /usr/share/pixmaps directory using superuser privileges.

Back to Technical Documentation index

Send questions or comments to ublinux-support@buffalo.edu

Last Modified 9/10/03 9:30am