Main Menu

From LXDE.org
Jump to: navigation, search
Note:
Manual editing operations described below are not recommended for regular users, they are explained here for those who want to dig deeply into your system structures and learn how those application files used in the menu are arranged system-wide.

For regular users using one of well known menu editors is adviced. See a list below.

The Menu-plugin is part of the LXPanel and follows the standards of freedesktop.org. The Menu-plugin does not provide graphical editing of the menu itself therefore external tools should be used. This article thus explains how to add new entries to the menu or edit present ones.

*.desktop files

These files are the entries for the menu. They are placed in:

  • /usr/share/applications
  • ~/.local/share/applications

Creating new ones or editing already existing files requires root access.

A sample file can look like this:

[Desktop Entry]
Encoding=UTF-8
Exec=warsow
Icon=/home/USER/my/icons/wsw-icon_80x80.png
Type=Application
Terminal=false
Name=Warsow
GenericName=warsow
StartupNotify=false
Categories=Game

This is my warsow.desktop file which I placed in /usr/local/share/applications

Here are the explanations for this file:

  • [Desktop Entry] - indicates that this file is a *.desktop file
  • Encoding=UTF-8 - UTF-8 encoding is used
  • Exec=warsow - path of a binary or script used to start the programm
  • Icon - path to the icon for the entry
  • Type=Application - desktop file is starting an application
  • Terminal=false - the program will not run in a terminal
  • Name=Warsow - displayed name in the menu
  • GenericName=warsow - description of the entry
  • StartupNotify=false - Startup notification is turned off
  • Categories - specifies the categories in which the entry will be placed in the menu (several categories are specified with a semicolon between them, e.g. 'Game;Education')

You can examine more examples in /usr/share/applications

Important for the menu is the 'Categories' key. Here are the most common categories: AudioVideo, Development, Education, Game, Graphics, Network, Office, Settings, System, Utility. There are also specific ones which can be viewed at freedesktop.org

Refreshing the Menu

In order to refresh the menu you can use this script taken from the LXPanel page:

#!/bin/bash

killall lxpanel
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
lxpanel -p LXDE &


You can also use lxpanelctl, which is part of lxpanel.

lxpanelctl restart

adding entries

First of all, I suggest that you put your new entries in /usr/local/share/applications since packages normally put them in /usr/share/applications and you have a better overview on your self-made entries. Now, to add a new entry become root and invoke the following:

# leafpad /usr/local/share/applications/your-program.desktop

while 'your-program' is obviously your desired program, warsow in my case. You can also use nano or any other terminal based text-editor instead of leafpad if you are more convenient with it. Now you can copy my sample and replace the values with your own ones.

You can also edit already existing entries, e.g. if you want to change the icon. Simply invoke (as root certainly):

# leafpad /usr/share/applications/pcmanfm.desktop

to edit PCManFM for example.

Menu Editors

  • The PCManFM can be used now to edit menu - since version 1.2.0 all the menu editing opearations are supported in Applications folder, except for separators (being a file manager, PCManFM shows only folders and applications, ignoring any separators).
  • The Alacarte is well known menu editor from GNOME project written in Python.
  • One can download and compile LXMED, a menu editor for LXDE written in Java, which requires GKSU.

References