|
This mini-tutorial should give you the information you need to customize your GNOME menus in Red Hat 8.0. Soon, hopefully, the instructions in this tutorial will be obsoleted by an errata update from Red Hat that will allow editing of menus via Nautilus. Feel free to direct any comments or suggestions to me at mknepher at bluethingy.com
UPDATE - 11/18/2002: Havoc Pennington posted this message to the RH 8.0 mailing list stating that, due to issues with the fixes in GNOME 2.0.2 breaking compatibility with KDE, getting a fix into Red Hat 8.0 has been delayed.
How the menus work
Red Hat's system menus use the vfolder spec - so the menus are "virtual folders" that are built using the XML file /etc/X11/desktop-menus/applications.menu This file references the *.directory files in /usr/share/desktop-menu-files, and the *.desktop files scattered about the system (the new default location is /usr/share/applications).
The applications.menu file
The applications.menu file begins with a list of directories to be merged in order to find all of the *.desktop files to be included as menu entries.
I would recommend reading carefully through applications.menu to familiarize yourself with the file's structure before making any changes. Be sure to make a backup of the original file before making any changes. The basic structure is as follows:
<VFolderInfo>
<MergeDir></MergeDir>
<DesktopDir></DesktopDir>
<Folder>
<Name>Foo</Name>
<Desktop>Foobar.directory</Desktop>
<Query>
<And>
<Keyword>Category</Keyword>
<Not>
<Keyword>Category</Keyword>
</Not>
</And>
</Query>
<Include>appname.desktop</Include>
<Exclude>appname2.desktop</Exclude>
<Folder>
...
</Folder>
</Folder>
</VFolderInfo>
The *.directory files
The *.directory files in /usr/share/desktop-menu-files hold the properties for the menu directories. Following is an abridged version of Applications.desktop:
[Desktop Entry]
Name=Applications
Name[da]=Programmer
Name[de]=Anwendungen
Comment=Applications
Comment[da]=Programmer
Comment[de]=Anwendungen
Icon=gnome-applications.png
Type=Directory
Encoding=UTF-8
The "Name" entry provides the name of the menu/directory as it is actually displayed, regardless of the value of the <Name></Name> tag in applications.menu.
The *.desktop files
The *.desktop files are similar, and hold the properties for the individual menu entries. Here is a brief version of the galeon.desktop file:
[Desktop Entry]
Name=Galeon
Comment=Galeon Web Browser
Exec=galeon
Terminal=0
Type=Application
Icon=galeon.png
Categories=Application;Network;X-Red-Hat-Extras;
The *.desktop files are queried on the values of "Categories". By default, the main menu directories restrict their queries to *.desktop files that are categorized by X-Red-Hat-Base or X-Red-Hat-Base-Only. For example, the default Applications -> Internet menu is defined like the following:
<!-- Internet -->
<Folder>
<Name>Internet</Name>
<Desktop>Internet.directory</Desktop>
<Query>
<And>
<Keyword>X-Red-Hat-Base</Keyword>
<Keyword>Application</Keyword>
<Keyword>Network</Keyword>
</And>
</Query>
<DontShowIfEmpty/>
</Folder>
The Extras menu folder will then display all *.desktop items that are not categorized under X-Red-Hat-Base or X-Red-Hat-Base-Only. (Note: If you look carefully at applications.menu, you will notice that the Extras subfolders reference the same *.directory entries as the main-level menu folders.)
Editing the Menus
The easiest way to add a new menu item is to find its *.desktop file and add an <Include>app.desktop</Include> line in the appropriate folder in applications.menu. If, for instance, you wanted to move the galeon entry from Extras -> Internet, you would add the following line to the main Internet section in applications.menu:
<Include>galeon.desktop</Include>
You could then also add the following line:
<Exclude>galeon.desktop</Exclude>
to the Internet folder under the Extras section.
If you want to add something to the menu that does not have a *.desktop file, you can easily copy an existing one and modify it to suit your needs. Then follow the same steps above to add the entry to the menu.
Creating submenus
To create a submenu, simply add a <Folder></Folder> entry within the section in which you want to put the new menu folder. Create a *.directory file in /usr/share/desktop-menu-files to set the name and other properties of the menu.
What if I want different users to have different menus?
Simply save a copy of applications.menu in ~/.gnome2/vfolders as applications.vfolder-info (you may need to create the vfolders directory) and make the appropriate changes for each user.
I don't like the Extras menu
You have several options:
1. Put every item in its menu under the main sections -- i.e., all internet apps appear directly under Applications->Internet. To do this, remove the X-Red-Hat-Base and X-Red-Hat-Base-Only keyword entries from the main-level folders, and delete the extras section. Depending on your installation, you may now have a boatload of entries in some menus.
2. Move the "Extras" menus so that they become submenus under the main menu sections -- i.e., Applications -> Internet -> Internet. If you want the submenu to have a different label (like, say, More Internet Apps), you will need to create a new *.directory file for the submenu with the appropriate name.
3. I don't need any of those stinking extras - just delete the whole extras section.
Once you're familiar with applications.menu, you'll be able to set up your menus just about any way you want. If you're lucky, Red Hat will release an errata update to allow changing menus in Nautilus the day after you get your menus just right. |
|