Subject: automatic menu entries (was Re: Alternatives system, 2nd round)
To: Julio M. Merino Vidal <jmmv84@gmail.com>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 01/21/2005 13:48:14
On Fri, 21 Jan 2005, Julio M. Merino Vidal wrote:

> However, I think we can start supporting menus in an easy way,
> following the menu specification published by freedesktop.org (and
> being a "standard" that more and more people are starting to support,
> I think this is the way to go).
>
> It is fairly flexible.  You have a pool of menu entries in
> share/applications, each one in its own .desktop file.  And then, you
> construct the menu based on these files, either following the Categories
> property in them or by using an external XML file that describes the
> menu structure).
>
> All we'd need to do to start this could be to bundle .desktop files for
> the packages we want in menus, and we'd even feed back them to the
> authors, I think.

Gentoo has some functionality for this. The
make_desktop_entry definition is like:

make_desktop_entry /path/to/executable Icon-name /usr/share/pixmaps/foo/icon.png Category /optional/startup/path

All it does is generate a /usr/share/applications/ desktop file:
[Desktop Entry]
Encoding=UTF-8
Version=0.9.2
Name=${name}
Type=Application
Comment=${DESCRIPTION}
Exec=${exec}
Path=${path}
Icon=${icon}
Categories=Application;${type};

(DESCRIPTION would be our COMMENT.)

Providing .desktop files will be the easiest and better for handling more
features and languages.

> GNOME and KDE support could come for free.  For other window managers,
> we'd need a tool that does the same as the major desktop do (read the
> .desktop files and construct the menu).  I don't know if there is any
> such program already, but if it's not, I think it may not be that hard
> to implement if we reuse some of the existing code.

One is
http://sourceforge.net/projects/vfmg which generates many menu formats
from the freedesktop.org (XDG) menu specification.

Maybe the  desktop-file-utils package can help too.

And maybe http://www.freedesktop.org/software/pyxdg/ and
http://freedesktop.org/wiki/Software_2fpyxdg  (URL has typo in it probably
due to recovery of wiki)

Shell scripts could be used, but may be better to use real .desktop menu
processing tools which should work with users' custom menus.

We could have each of our window manager packages provide a script to
handle the generation of their own menus -- stored in SYSCONFDIR.

Then another package to provide a script that when ran will run all the
other scripts that are installed. For example, no icewm menus are
generated if only openbox is installed.

We could add have an +INSTALL and +DEINSTALL function check if this
special menu generation tool or package is installed -- and if it is then
run it.

See gentoo's proposal at http://www.gentoo.org/proj/en/glep/glep-0016.html

Anyways, we could have each window manager package maintainer add their
own package or tool for this specific conversion. Or we could attempt to
have a big tool that can handle all. For example, the script
http://vsbabu.org/gnu/kbbmenu.txt might work for blackbox. (I will try
it.)

Do we need to make sure that all .desktop files are installed to one
place? (Do we have different /usr/pkg/gnome/apps/ and
$KDEDIR/share/applnk/ directories? I should look ....)

> FWIW, GNOME 2.10 will come with a library, gnome-menus, to manage all
> this stuff.

 Jeremy C. Reed

 	  	 	 technical support & remote administration
	  	 	 http://www.pugetsoundtechnology.com/