LXDE Menu entirely uneditable

This is extremely frustrating. I am using the OpenSUSE branding of LXDE and the menu is extremely limited, and nothing I do affects it. How on earth do you edit this menu? All of the configs I can check show the office category and a bunch of others. lxmed, alacarte, /etc/xdg/menus, /usr/share/desktop-directories, I tried changing $XDG_MENU_PREFIX to “suse-” instead of “lxde-” … none of these have any effect on the menu. pcmanfm can go to menu:// and shows the actual menu I see, which has accessories, education, games, graphics, internet, run, and logout, and is missing a whole bunch of stuff like the office & multimedia category. I don’t think this is an LXDE problem because these are methods that are supposed to work for LXDE. Where does pcmanfm get those categories from? Why is so much stuff missing?

This is my own setup, but I hope it can show you how it works.

$ set | grep XDG
XDG_CONFIG_DIRS=/usr/local/config/xdg:/etc/xdg
XDG_CONFIG_HOME=/home/openSUSE/agnelo/.config
XDG_CURRENT_DESKTOP=LXDE
XDG_DATA_DIRS=/usr/local/share:/usr/share
XDG_MENU_PREFIX=lxde-
XDG_RUNTIME_DIR=/run/user/agnelo
XDG_SEAT=seat0
XDG_SESSION_COOKIE=40527be2480f8cf60f4e8d4b000006b0-1332077757.494477-2009304717
XDG_SESSION_ID=426
XDG_VTNR=1

It means that I’m using the menu file** /usr/local/config/xdg/menus/lxde-applications.menu.
**

You can define the location and name (prefix) of the menu by setting the variables XDG_CONFIG_DIRS (at system level) and XDG_MENU_PREFIX. I think the default should be /etc/xdg/menus/lxde-applications.menu,

The syntax of the menu file should be explained on freedesktop.org (which doesn’t respond right now). Modifying an existing file is not very complicated. Here’s an example of a menu entry with a submenu. You can create as many menus, submenus, sub-submenus, etc, as you like.

<Menu>
    <Name>Applications-Editors</Name>
    <Directory>Editors.directory</Directory>
        <Menu>
            <Name>Applications-Editors-Kde</Name>
            <Directory>Kde.directory</Directory>
             <Include>
                 <Category>X-Applications-Editors-Kde</Category>
              </Include>
         </Menu>
     <Include>
         <Category>X-Applications-Editors</Category>
     </Include>
</Menu>

Menus look for two things: a .directory file and applications (.desktop) files. The location of .directory and .desktop files is given by the variable XDG_DATA_DIRS (at system level). In my example, it is /usr/local/share. Thus, the menu “Applications-Editors” reads the .directory file /usr/local/share/desktop-directories/Editors.directory, which looks like this:

$ cat /usr/local/share/desktop-directories/Editors.directory 

[Desktop Entry]
Encoding=UTF-8
Type=Directory
Icon=folder-green
Name=Editors

This file contains the name that will be displayed (Editors) and the icon that will be used.
The other important information for the menu is the Category -here, for the Editors menu “X-Applications-Editors”. FreeDesktop compliant wms look for .desktop files which contain categories and display the applications which include these categories in their .desktop file. The ,desktop files are located - in my example - in /usr/local/share/applications (and subdirectories). The default is /usr/share/applications.

Here’s a .desktop file including the category “X-Applications-Editors”:

$ cat /usr/local/share/applications/X_gvim.desktop 

[Desktop Entry]
X-SuSE-translate=true
Categories=X-Applications-Editors;
Encoding=UTF-8
Name=Vi IMproved
GenericName=Text Editor
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=gvim -f %f
Icon=gvim
Type=Application
Terminal=false
X-KDE-StartupNotify=true
X-KDE-AuthorizeAction=shell_access

It will appear with the name “Vi IMproved” with the icon “gvim.png” under the menu “Editors” and execute the command defined in the Exec key.

Created a (hopefully) simple How-To which includes a little bit from the above post

Do not use LXMED.** It will corrupt your main menu.**

Instead, I have created simple instructions for creating new LXDE Main Menu items, slightly modified to apply to openSUSE.
http://en.opensuse.org/User:Tsu2/LXDE-Main_Menu

Enjoy!

TSU