On 02/09/2009 14:59, Charles Wilson wrote:
IMO, each (X) package should, in its own postinstall script, create the
start menu shortcut it needs, using mkshortcut from cygutils.
Well, perhaps GUI X packages. A lot of the X.Org apps are diagnostical
in nature and hence are designed to be run from the command line. There
are a few which provide real functionality (nothing that isn't available
elsewhere with a modern GUI), and even those don't show up in the
standard X11 desktop menus.
That postinstall script should also invoke whatever tool is necessary and
supported to add its opendesktop menu items to the cygwin area, so that
cygwin/gnome and/or cygwin/kde window managers are happy -- at the
package maintainer's discretion.
If you are referring to /usr/share/applications/*.desktop used by
GNOME/KDE/Xfce/LXDE, those files are shipped by each package and are
part of the tarball, not created by postinstall. For those GUI packages
which don't ship a .desktop menu, one can be created by calling
make_desktop_entry() in src_install().
I believe Yaakov's ideas revolve around automating this with certain
primitives to be invoked within .cygport packaging scripts.
That was my original train of thought. But as there already exists a
cross-desktop menu system in the X11 world, I would rather find a way to
use that instead, rather than maintaining a second menu system just for
Cygwin.
My grand idea would be for XWin itself to implement the desktop menu,
parsing /usr/share/applications/ on startup, and generating a menu
structure that could be used in .XWinrc as so:
menu root {
"Reload .XWinrc" RELOAD
"Applications" LAUNCHER
SEPARATOR
}
ROOTMENU root
The attached script provides an example of what such a menu would look
like in XWin if done manually. I just put this together, so it's a bit
rough, but it should give you an idea of the result (but obviously not
the implementation).
OTOH, someone would have to write this parser -- we probably can't use
any of the existing ones, since most of them have dependencies beyond
those of XWin, and are under licenses which are more restrictive than
MIT/X11. And as a Windows app, XWin knows only about .ICO icons, so
supporting the PNG/SVG icons typically used in FD.o menus would be more
work.
If that is not plausible, then I suppose the fallback would be to have
cygport handle this by parsing the .desktop file, generating a
postinstall mkshortcut command, and creating an .ICO from the
corresponding PNG/SVG with ImageMagick/GraphicsMagick/Netpbm/etc. The
major drawback of this approach is in the case of split-packages, as
this would require some special handling of the postinstall, as well as
changes to each subpackage's .list file or _CONTENTS variable.
How to manange the transition, from the monolithic X-start-menu-icons
package and script, to this distributed approach -- no idea.
Either way, the transition means obsoleting X-start-menu-icons by
causing it to be uninstalled through "upgrading" it to an empty tarball.
Yaakov
Cygwin/X
#! /bin/sh
# See http://standards.freedesktop.org/menu-spec/latest/
# Main Categories:
cats="AudioVideo Development Education Game Graphics Network Office Settings
System Utility"
# The following line must be added manually to the designated ROOTMENU
# "Applications" MENU fdoapps
echo "MENU fdoapps {"
for cat in ${cats}
do
echo -e '\t'${cat} MENU ${cat}
done
echo "}"
# FIXME: fallback for (faulty) menus which specify none of the Main Categories
for cat in ${cats}
do
echo "MENU ${cat} {"
for app in $(find /usr/share/applications -name '*.desktop' | xargs
grep -l "Categories=.*${cat};")
do
# not intended for
grep -q '^NoDisplay=true' $app && continue
grep -q '^OnlyShowIn=' $app && continue
eval $(grep '^Exec=' $app | sed -e 's|=\(.*\)|="\1"|g')
eval $(grep '^Name=' $app | sed -e 's|=\(.*\)|="\1"|g')
echo -e '\t'\"${Name}\" EXEC \"${Exec%% *}\"
done | sort -f
echo "}"
done