Page 1 of 1

Adding custom sub-menu in LXDE main menu

Posted: Tue Aug 18, 2009 9:48 pm
by modest
So I have to files called README.desktop and Install.desktop which I have copied them at /usr/share/applications.

Here is what they look like:
Install.desktop

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Version=3.3.3
Name=Install
Comment=Program Installer
Exec=lxterminal --command "./install.sh"
Icon=/usr/share/pixmaps/debian-logo.png
Terminal=false
Type=Application
README.desktop

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=README
Comment=README file
Exec=leafpad /root/README.TXT
Icon=/usr/share/pixmaps/readme.xpm
MimeType=text/plain
Terminal=false
Type=Application
MimeType=text/plain
So upon searching I know we can include them in the already default Main menu by adding the tag "Categories=<some-already-defined>". So for example, if I want them to appear under "Accessories" menu, all I need is to add "Categories=Utility" in the above two files and it will start appearing.

However, I would like to display the two files in my own sub-menu say for example, "MyMenu". How do I do that? I know there was some thread which talks about valid categories and all but can't seem to figure out.

Also I tried the suggestion mentioned here:
http://u-lite.org/content/lxde-capable- ... omment-717
but no luck.

Re: Adding custom sub-menu in LXDE main menu

Posted: Wed Aug 19, 2009 3:58 pm
by paxman
...

Re: Adding custom sub-menu in LXDE main menu

Posted: Wed Aug 19, 2009 4:14 pm
by paxman
You'll have to edit per-user menu configuration file. Usually, it resides is in ~/.config/menus, under the name of "lxde-applications.menu". It should be something like (if empty, just copy & paste the following text)

Code: Select all

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
	<Name>Applications</Name>
<MergeFile type="parent">/etc/xdg/menus/lxde-applications.menu</MergeFile>

</Menu>

Now, if you wan't to add, say the file README.desktop launcher under Accesories menu, change the upper text to the following:

Code: Select all

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
	<Name>Applications</Name>
<MergeFile type="parent">/etc/xdg/menus/lxde-applications.menu</MergeFile>
<Menu>
			<Name>Accessories</Name>
			<Include>
<Filename>README.desktop</Filename>
			</Include>
</Menu>
</Menu>


To add README.desktop to a "Accessories" sub-menu "MyMenu", change to the following:

Code: Select all

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
	<Name>Applications</Name>
        <MergeFile type="parent">/etc/xdg/menus/lxde-applications.menu</MergeFile>
        <Menu>
			<Name>Accessories</Name>
                        <Menu>
			            <Name>MyMenu</Name>
                                   <Directory>MyMenu.directory</Directory>
			           <Include>
			                       <Filename>README.desktop</Filename>
			           </Include>
                        </Menu>
        </Menu>
</Menu>
To add it to other LXDE provided menus, change "Accessories" accordingly.
Note the "MyMenu.directory" line. This is the file that provides the directory name, icon, comment and other properties. If the file does not exist, you'll have to create one; copy it to "~/.local/share/desktop-directories" directory, with the (minimal) content of:

Code: Select all

          [Desktop Entry]
          Encoding=UTF-8
          Icon=/path/to/icon
          Name=MyMenuOrSimilar
For more information on creating/editing menus, do read Freedesktop's Desktop file and Menu specification.