Re: FVWM: Sensitive building menus

From: Manfred Bartz <mbartz_at_werple.net.au>
Date: 07 Oct 1997 10:04:02 +1000

Bruce Stephens <B.Stephens_at_isode.com> writes:

> Anders Eriksson said:
> > The question is how do I make AddToMenu entry which only lick-in if
> > the appropriate binary exist?
>
> I don't know, but I have a fvwm95 setup which does this. I think it's called
> The Next Level, or something. A quick search should find it. It uses fvwm95,
> but I don't think the technique relies on anything that's not in core fvwm2; I
> suspect the trick is in using m4.

I agree.

Something like this should work (it does on my system):
    m4_changequote({,})
    m4_define(NETSCAPE, {/usr/local/bin/netscape})
    m4_define(NS_IS_PRESENT,
        {m4_esyscmd(if [ -x NETSCAPE ];
        then echo -ne "yes" ; else echo -ne "no" ; fi)})
    NS_IS_PRESENT
    m4_ifelse(NS_IS_PRESENT,yes,{Exec NETSCAPE})
When run with ``m4 -P AboveFile.m4'' it produces 3 blank lines and:
    yes
    Exec /usr/local/bin/netscape

Note the ``echo -ne ""''. Without that echo produces the string
followed by a newline, and "yes" is not the same as "yes\n" when you
test in ``m4_ifelse()''.

Cheers :-)
-- 
Manfred Bartz <mbartz_at_werple.net.au>
--------------------------------------------------------------
Would you put the worlds best wooden wagon wheels on your car? 
Then why buy 56k anti-technology?
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Mon Oct 06 1997 - 18:56:14 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:01 BST