On Tue, Jun 27, 2006 at 01:01:57PM +0200, Michael Stilkerich wrote: > * Bill Allombert <[EMAIL PROTECTED]> [2006-06-27 11:12]: > > However, I think the best fix would be to rewrite CommandWOArgs so that > > it does not need to use shell() at all, since it is slow. > I cannot think of a way to extract the first whitespace seperated token > from the command with the functions provided by the debian menu system. > If there is, please give me a hint. > > If not, I would suggest the following > (please keep in mind that the actually executed command will be run > in a shell and is the unmodified $command, and is not affected by the > return value of CommandWOArgs) > > function CommandWOArgs()=shell("sh -c 'echo -n $0' " > replacewith(stripdir($command), > "\\\"$`'!", " ") > ); > > Again, the purpose of this function is to extract the name of the binary > that will be run. The menu entry will only be displayed if fvwm-crystal > finds a binary with this name in the PATH (and assign an icon with that name). > Now this will not work for shell builtin functions, but the only effect > will be that those menu entries will not be visible. > > The idea of the above is, that stripdir will by chance provide me > with the name of an executed binary (if there is one with absolute > path given). This will, e.g. work for Bill's testbacktics example. > I will then replace all shell special characters with spaces, and take > the first word of the remaining string. > > This approach will not work for some menu entries, but should not > yield any errors when running update-menus. For those entries where > it does not yield the correct name of the executable (if there is any), > the entry will simply not be available.
Well, frankly this is so broken I would advise you to patch fvwm-crystal to handle the menu better. Maybe you can change it so that a binary name of %icon.png% is taken as a binary "always available" with an icon "icon.png". You could still use the normal mechanism if the command is a single work without space and metacharacter. This sould not be hard to do. I don't see much point working around this issue inside the menu-method. I don't consider OK to not display menu entries like this one: ?package(local.test):command="LANG=ja_JP.EUC-JP kterm" needs="X11" \ section="Apps/Test" title="test ENV" Cheers, Bill. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]