Difference between revisions of "Main Menu"

From LXDE.org
Jump to: navigation, search
(*.desktop files)
(Refreshing the Menu)
Line 46: Line 46:
 
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
 
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
 
lxpanel -p LXDE &
 
lxpanel -p LXDE &
 +
</pre>
 +
 +
 +
You can also use lxpanelctl, which is part of lxpanel.
 +
<pre>
 +
lxpanelctl restart
 
</pre>
 
</pre>
  

Revision as of 11:02, 24 November 2011

The Menu-plugin is part of the LXPanel and follows the standards of freedesktop.org. Unfortunately, LXDE does not provide graphical editing of the menu yet. 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 Editor

One can download and compile LXMED, a menu editor for LXDE written in Java, which requires GKSU.

see also

References