Subject: FVWM: Generalized PipeRead

From: Neil Zanella <[email-masked]>
Date: Sat, 6 May 2000 20:58:44 -0230 (NDT)

Hello,

It would be nice if there was a generalized version of PipeRead called
PipeReadString which worked as follows: the output of

PipeReadString command.sh

would be the output of the (shell script) command. However, unlike with
PipeRead, this output would not be Exec'ed directly. Instead the output
would appear in front of an Exec command as an argument. For example:

Exec xterm -bg PipeReadString bg.sh -fg PipeReadString fg.sh

The advantage of PipeReadString over PipeRead is that of readability.
Only the parameters that do change can be the output of the shell
script rather than the whole command. That way the Fvwm script can
more easily document which parameters are subject to change and which
ones are not.

Best Regards,

Neil

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
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: Michael Han <[email-masked]>
Date: Sat, 06 May 2000 18:05:18 -0700

Previously from Neil Zanella
>more easily document which parameters are subject to change and which

As your second question implies, this kind of functionality is, IMHO,
better achieved using a preprocessor. Even better would be to use
FvwmTheme to define a colorset and perform a variable substitution in
an Fvwm function, as in:

AddToFunc StartXTerm I Exec xterm -bg $[bg.cs0] -fg $[fg.cs0]

All in all, it's a better way to have consistent control over colors.
I take advantage of the fact that xrdb cpp-preprocesses
.Xdefaults/.Xresources to do something similar to my resource files.
Still haven't gotten around to setting up FvwmTheme and colorsets in
my .fvwm2rc though.
-- 
[email-masked]                         http://www.best.com/~mikehan/
coffee achiever                              San Francisco, California
Unix *is* user friendly. It just happens to be very selective about who its
friends are.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
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: Dan Espen <[email-masked]>
Date: Sat, 06 May 2000 20:18:16 -0400

> Exec xterm -bg PipeReadString bg.sh -fg PipeReadString fg.sh

Does this work:

PipeRead "echo Exec xterm -bg `bg.sh` -fg `fg.sh`"

--
Dan Espen
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854                     Phone: (732) 699-5570
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
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: Neil Zanella <[email-masked]>
Date: Tue, 9 May 2000 20:47:16 -0230 (NDT)

Your first suggestion:

"I" Exec xterm -fg `fg.sh` -bg `bg.sh`

does work for me. I should have thought of it.
It seems to me that with the current implementation of Exec I can follow
exec by any shell command I want so long as it does not use environment
variables.

As to your second suggestion:

This also works. For the particulr problem I posed the first solution is
a little bit cleaner but your second solution shows that PipeRead is even
more powerful than I thought eliminating the need for a generalized
version. Thanks! Keep up the good work!

Best Regards,

Neil

---

From: [email-masked] (Paul D. Smith)
Date: 09 May 2000 19:56:23 -0400

%% Neil Zanella <[email-masked]> writes:

  nz> Your first suggestion:

  nz> "I" Exec xterm -fg `fg.sh` -bg `bg.sh`

  nz> does work for me. I should have thought of it.  It seems to me
  nz> that with the current implementation of Exec I can follow exec by
  nz> any shell command I want so long as it does not use environment
  nz> variables.

Why can't it use environment variables?  You may need to quote the $ to
get fvwm to ignore it, I can't remember if it will do something with $
variables or not.

Any valid shell command is OK for Exec, including ones that reference
environment variables.  But, the variables are expanded by the shell
that Exec invokes, not by FVWM before it's invoked.

  nz> As to your second suggestion:

  nz> PipeRead "echo Exec xterm -bg `bg.sh` -fg `fg.sh`"

  nz> This also works. For the particulr problem I posed the first
  nz> solution is a little bit cleaner but your second solution shows
  nz> that PipeRead is even more powerful than I thought eliminating the
  nz> need for a generalized version. Thanks! Keep up the good work!

PipeRead isn't any more or less powerful; it's invoking a shell.  Shells
are _very_ powerful :).  Any shell operations are valid in a PipeRead
command.  The `` is being expanded by the shell that FVWM runs, not by
the PipeRead builtin.  You probably grok that, I'm just making it clear
in case someone else is confused...

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
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: Dan Espen <[email-masked]>
Date: Tue, 09 May 2000 21:32:30 -0400

> in case someone else is confused...

Hey!  You don't mean me do you?  (It was just meant to illustrate
the point.)

Actually I'm just posting now to check that a mail problem I was
having is cured.  (Thanks Jason.)