Editing System Menus
You can edit menu configuration files and menu data files manually
to customize menus.
To add a menu for all users, perform the following steps:
Create a directory entry file for the item that you want to
add. Place the directory entry file in the
$XDG_DATA_DIRS/desktop-directories
directory. For more information on directory entry files, see the section called “Directory Entry Files”.
Locate the
$XDG_CONFIG_DIRS/menus/applications.menu
file.
In the .menu file, add a
<Menu> element for the new menu. For more
information on .menu files, see the section called “Menu Definition Files”.
Create a <Name> element below
<Menu>. The content of the element should
contain the name for the menu.
Create a <Directory> element below
<Menu>. The content of the element should
contain the name of the directory entry file.
See the section called “Adding an Item to a Menu” for how to add an item
to the menu.
The next time that users log in, the menu should appear in the
menu bar.
| Missing Menu? |
---|
If you did not specify any matching rules in the
<Include> element, or if the rule did not
match any desktop entries, then you may not see the menu in the menu
bar. |
To add an item to a menu for all users, perform the following
steps:
Create a desktop entry file for the item that you want to add.
For more information on desktop entry files, see the section called “Desktop Entry Files”.
Place the desktop entry file in the
$XDG_DATA_DIRS/applications folder.
Locate the
$XDG_CONFIG_DIRS/menus/applications.menu
file.
Verify that a <Menu> element contains
an <Include> element with a matching rule
that selects the desktop entry file made in step 1.
The next time that users log in, the menu item is in the assigned
location.
Editing the Properties of a Menu
To edit the properties of a menu for all users, perform the
following steps:
Locate the
$XDG_CONFIG_DIRS/menus/applications.menu
file.
Find the <Menu> entry in this file
that corresponds to the menu you want to modify. Note the filename
of the directory entry in the <Directory>
element.
Locate the directory entry for this menu. Modify the contents
to change the properties of the menu. For more information on
.directory files, see the section called “Directory Entry Files”.
To edit a menu item, perform the following steps:
Locate the desktop entry in the
$XDG_DATA_DIRS/applications
directory that corresponds to the menu item.
Edit the desktop entry to change the properties of the menu
item. For more information on desktop entry files, see the section called “Desktop Entry Files”.
Deleting an Item from a Menu
To delete an item from a menu for all users:
Locate the
$XDG_CONFIG_DIRS/menus/applications.menu
file.
Find the <Menu> element in this file
that contains the desktop entry you want to delete.
Insert an <Exclude> element after the
closing tag for the <Include> element. Make
sure this is in the <Menu> element
determined in step 2.
Insert the <Filename> matching rule
as a subelement of <Exclude> to
specifically exclude a desktop entry.
The next time that users log in, the menu item is not displayed in
the menu. Example 2.2, “Deleting an Item from a Menu” shows how this
done in the applications.menu file. The desktop
entry for dasher.desktop is explicitly excluded
from showing up in the accessibility menu.
Example 2.2. Deleting an Item from a Menu
<!-- ... -->
<Menu>
<Name>Accessibility</Name>
<Directory>Accessibility.directory</Directory>
<Include>
<And>
<Category>Accessibility</Category>
<Not><Category>Settings</Category></Not>
</And>
</Include>
<Exclude>
<Filename>dasher.desktop</Filename>
</Exclude>
</Menu>
<!-- ... -->