Bug 10755

Summary: X-start-menu-icons needs improvement or replacement
Product: cygwin Reporter: Jon Turney <jon.turney>
Component: Cygwin/XAssignee: Yaakov Selkowitz <yselkowi>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: Patch for X-start-menu-icons.in
Generated X-start-menu-icons.sh for testing purposes
Setup.exe patch
Sample start menu link description file for emacs
Add INCLUDE directive for Xwinrc

Description Jon Turney 2009-10-11 14:22:18 UTC
X-start-menu-icons has lots of problems, as discussed in thread
http://cygwin.com/ml/cygwin-apps/2009-08/msg00056.html. 

Not having emacs work nicely when launched from the start menu is especially
unhelpful, though
Comment 1 Jon Turney 2009-10-11 14:31:38 UTC
Created attachment 4266 [details]
Patch for X-start-menu-icons.in

Updated X-start-menu-icons.in, adding some fixes and enhancements:

* Read per-package icon files from /etc/X11/X-star-menu-icons.d/*
* Add the abilility to specfiy icons which are in separate files (not in
run.exe or the target executable)
* Remove additions of /usr/X11R6/bin to path
* Use a login shell to start executables
* Delete and recreate links on each run, so stale links are removed
Comment 2 Jon Turney 2009-10-11 14:34:32 UTC
Created attachment 4267 [details]
Generated X-start-menu-icons.sh for testing purposes

Attached X-start-menu-icons.sh for testing purposes.

Note there's some autoconf bogosity so just ./configure doesn't substitute
${prefix} in the output, you have to explicity specify the prefixes substituted
e.g. ./configure --exec-prefix=/usr --sysconfdir=/etc
Comment 3 Jon Turney 2009-10-11 14:40:53 UTC
Created attachment 4268 [details]
Setup.exe patch

X-start-menu-icons.sh should be run after every package install/uninstall which
is pointed to by a shortcut to add/remove shortcuts as needed.

Example patch for setup implementing a mechanism for a package postinstall
script to run after every install/uninstall (by avoiding renaming it to .done
if it starts __)

This mechanism wouldn't be neccessary if we move *all* the links in
/etc/X11/X-start-menu-icons-list into files owned by the package which owns the
executable they point to, and arrange for them to have postinstall/preremove
triggers which run X-start-menu-icons.sh
Comment 4 Jon Turney 2009-10-11 14:42:22 UTC
Created attachment 4269 [details]
Sample start menu link description file for emacs
Comment 5 Jon Turney 2009-10-11 14:55:37 UTC
Additional issues noticed:
* X-start-menu-icons.sh can only make links named after the executable they
point to. You can't supply arguments to the executable.  You can't have multiple
links to the same executable with different names and arguments.
* 'text app' links (which are run in an xterm) are assumed to take the -display
argument.  This fails for e.g. fc-list
* Hardcodes 127.0.0.1:0.0, which is perhaps bad
* Links fail silently if X server isn't running.  Need a wrapper which
checks/starts it with --silent-dup-error?
Comment 6 Jon Turney 2009-12-28 21:51:37 UTC
See http://sourceware.org/ml/cygwin-apps/2009-09/msg00020.html for a suggestion
to dynamically generate the Xwin traymenu from .desktop files, which seems a
better way of doing this
Comment 7 Jon Turney 2010-02-06 21:19:37 UTC
Created attachment 4576 [details]
Add INCLUDE directive for Xwinrc

As an small step in this direction, here is a patch which adds support for an
'include' directive to XWinrc processing, which can read from a file or the
output of a command.  As an example, this can be used to read the output of the
xwinmenu.sh script in the linked email, to dynamically populate the menu with
commands with .desktop files.
Comment 8 Yaakov Selkowitz 2010-02-25 09:54:34 UTC
xwinmenu.sh was never meant to be the implementation of an FD.o menu.  It's way 
too slow to use on XWin startup, for one.

The solution would be to add a new token to XWinrc, which triggers code that 
readdir()s $XDG_DATA_DIRS/applications:$XDG_DATA_HOME/applications, open()s each 
.desktop file, fscanf()s it according to the FD.o Desktop Entry Spec, and 
creates a menu from that data.  But that will have to be another day.

OTOH I like the INCLUDE token for *files*.  I'll try to rebase this patch for 
files only in the next few days.

Comment 9 Jon Turney 2016-06-02 14:27:48 UTC
(In reply to Jon TURNEY from comment #6)
> See http://sourceware.org/ml/cygwin-apps/2009-09/msg00020.html for a
> suggestion
> to dynamically generate the Xwin traymenu from .desktop files, which seems a
> better way of doing this

We now have that with xwin-xdg-menu, which has obsoleted X-start-menu-icons.