Wednesday, May 26, 2010

Adding Sub-menu to main menu



**** This is GNOME-Specific ****
How to add the submenu to the Main menu in Ubuntu-9.04
(May be applicable to all the distribution)


I am writing this, in particular, for the wine submenu.
I install the MS-Office-w2k3 though wine on Ubuntu-9.04 and observed the following steps for the same.


1. Add the name of the sub-menu to the main menu by editing the file

/etc/xdg/menu/applications.menu or /etc/xdg/menu/applications-merged/wine.menu

The entry will go like this:

< menu >
< name >wine-Programs-MS-Office< /name >
< directory >wine-Programs-MS-Office.directory< /directory >
< include >
< catagory >Wine-Programs-MS-Office< /category >
< /include >
< /menu >


This will create a ready-to-add submenu named "MS-Office" in Applications -> wine -> Programs

2. This submenu is actually get added when we create the file "/usr/share/desktop-directories/wine-Programs-MS-Office.directory" and adding the following content to it:

[Desktop Entry]
Type=Directory
Name=MS-Office
Icon=folder


3. Now we need to add the item's to this submenu by creating one file per item in /usr/share/applications with the extension ".desktop"

Here is sample code for one of the file "wine-word.desktop"

Name=WORD
Comment=Microsoft's WORD Processor
Exec=wine "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"
Terminal=false
Type=Application
Icon=msword
Categories=Wine-Programs-MS-Office;


In this file, name is name. Exec is the command to be get executed when we click on this item. And catagories is the place where this item is supposed to go.
This will use the icon specified by Icon and will find in /usr/share/pixmaps folder.


For all the item's, repeat last procedure.

No comments:

Post a Comment