Subject: FVWM: Sensitive building menus

From: Anders Eriksson <[email-masked]>
Date: Mon, 06 Oct 1997 09:45:44 +0200

Hi,

I have three .fvwm2rc's in three different places which I 
try to keep in sync to get a similar environment in all places.
This is no big deal apart from updating the paths at the to of 
the .rc file. The question is how do I make AddToMenu entry which only
lick-in if the appropriate binary exist?

E.g. I'd like to do something like...

if -exist `which netscape` then
 AddToMenu netscape netscape bla bla...
end

/Anders
PS I'm not on the list, please reply directly to me.
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: fractture <[email-masked]>
Date: Mon, 06 Oct 1997 05:33:19 -0700

> PS I'm not on the list, please reply directly to me.

I wsould be interested in any answer to this question as well, please
reply to all.......

---

From: Bruce Stephens <[email-masked]>
Date: Mon, 06 Oct 1997 13:39:54 +0100

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.

---

From: Manfred Bartz <[email-masked]>
Date: 07 Oct 1997 10:04:02 +1000

> 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 <[email-masked]>
--------------------------------------------------------------
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 [email-masked].
To report problems, send mail to [email-masked].