Where are the links/shortcuts stored in GNOME?

Taking care of your Linux box.

Where are the links/shortcuts stored in GNOME?

Postby s7r1k3r » Thu Jul 24, 2003 11:02 pm

Assalam-O-Alaekum!

Does anyone know how GNOME stores its startup menu links and how to add links to it through coding. I mean what is the directory or file that stores the names of all the links in the menus like applications, accessories, graphics etc?

ALLAH HAFIZ.
a10n3 s7r1k3r
s7r1k3r
Battalion Quarter Master Havaldaar
 
Posts: 221
Joined: Wed Aug 07, 2002 3:02 pm
Location: Rawalpindi

Postby Faraz.Fazil » Fri Jul 25, 2003 12:02 am

Read this carefully.You will get the answer.

[Editing GNOME Menus in Red Hat Linux]

This mini-tutorial should give you the information you need to customize your GNOME menus in Red Hat . These instructions also work for the current Phoebe beta. Feel free to direct any

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 file that has the list
=============================================
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 Menu Structure
===========================
To add a new menu item system-wide, 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?
=================================================
If you are going to alter a user's menu structure, 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.

To add or move individual items without altering the menu structure, create the directory ~/.gnome2/vfolders/applications and copy or create the *.desktop file to that directory. Open up the file in your favorite editor and set the appropriate Categories for the menu/submenu in which you would like to place the item (don't forget "X-Red-Hat-Base" to force it into a top-level menu. In the case where you are copying an existing *.desktop file, files in the user's ~/.gnome2/vfolders/applications directory will supersede the system-level files.
I don't like the Extras menu

You have several options:

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.
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.
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.

Some easy methods:
=====================

Easy editing
----------------
(only applies to apps that generate good .desktop files and files modified by the above scripts, and not at all to gnome-panel-2.0.1)

To add menu item
-------------------
Click on applications menu, move mouse to any item, right click, move mouse to entire menu , right click again, choose add new item
Fill in properties window as required

To delete menu item
--------------------------
Click on applications menu, move mouse to any item, right click, move mouse to entire menu , right click again, choose remove item
Fill in properties window as required

To add menu item
------------------------
Click on applications menu, move mouse to any item, right click, move mouse to entire menu , choose properties
Fill in properties window as required

To move menu items
-------------------------
Open Nautilus
Find item you want to move to a different category, copy, move to directory entry where you want it to go, paste it.
Nautilus is liable to freeze but it works.

The easy methods only work some times, whereas the difficult methods (mentioned before in the beginnig are more effective)
Faraz.Fazil
Major General
 
Posts: 1024
Joined: Thu Jul 04, 2002 5:31 pm
WLM: faraz7476@hotmail.com
Location: Karachi/Pakistan/Earth/Universe

Postby fawad » Fri Jul 25, 2003 2:58 am

Wow Faraz.Fazil,
This is really cool information. I've been stumped by this one too many times. You think you can put this on the wiki? Maybe create a page under LinuxFaq? If we consolidate this frequently asked stuff, we can store it in a seperate location and point people to it instead of digging through the forum archives.
fawad
Site Admin
 
Posts: 918
Joined: Wed Aug 07, 2002 8:00 pm
ICQ: 17672437
Website: http://www.fawad.net
WLM: fawadhalim@hotmail.com
Yahoo Messenger: fawad2048
AOL: fawadhalim
Location: Addison, IL

Postby Faraz.Fazil » Fri Jul 25, 2003 9:15 pm

Thanx fawad bhai.
I will post it at wiki soon.
Faraz.Fazil
Major General
 
Posts: 1024
Joined: Thu Jul 04, 2002 5:31 pm
WLM: faraz7476@hotmail.com
Location: Karachi/Pakistan/Earth/Universe

Really helpful!

Postby s7r1k3r » Sat Jul 26, 2003 12:48 am

Assalam-O-Alaekum!

As fawad said. This information war REALLY helpful. Thanx a bunch. :D

ALLAH HAFIZ.
a10n3 s7r1k3r
s7r1k3r
Battalion Quarter Master Havaldaar
 
Posts: 221
Joined: Wed Aug 07, 2002 3:02 pm
Location: Rawalpindi

Postby Faraz.Fazil » Sat Aug 02, 2003 9:49 am

Faraz.Fazil
Major General
 
Posts: 1024
Joined: Thu Jul 04, 2002 5:31 pm
WLM: faraz7476@hotmail.com
Location: Karachi/Pakistan/Earth/Universe


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron