Subject: FVWM: PipeRead

From: Scott Smedley <[email-masked]>
Date: Sat, 5 Apr 2003 13:18:07 +1000

Hi all,

I know this is not valid FVWM syntax but it shows what I'm trying to do:

*FvwmButtons: Fore `cat HOME/.fvwmColors | cut -f3`
*FvwmButtons: Back `cat HOME/.fvwmColors | cut -f2`

DeePBLue>> cat ~/.fvwmColors    
violetred4 yellow darkcyan antiquewhite

What's the best way to get this behaviour? I tried using a PipeRead:

PipeRead 'if [ -r $HOME/.fvwmColors ] ; then \
			fg=`cat $HOME/.fvwmColors | cut -f3 -d" "` \
			bg=`cat $HOME/.fvwmColors | cut -f4 -d" "` \
		else \
			fg=AntiqueWhite \
			bg=RoyalBlue \
		fi; \
		echo "*FvwmButtons: Fore $fg"; \
		echo "*FvwmButtons: Back $bg"'

But if I put this PipeRead command in a file (say 'testPR') & do a:

Read testPR

from FvwmForm-Talk I get this error message:

sh: -c: line 2: syntax error: unexpected end of file

Any help/pointers greatly appreciated.

SCoTTie! :)
--
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: Fri, 04 Apr 2003 22:52:51 -0500

> Any help/pointers greatly appreciated.

Work from something simpler up to what you need.

As one line, I got the else clause to work like this:

PipeRead 'if [ -r $HOME/.fvwmColors ] ; then  fg=`cat $HOME/.fvwmColors | cut -f3 -d" "`; bg=`cat $HOME/.fvwmColors | cut -f4 -d" "`; else fg=AntiqueWhite bg=RoyalBlue;  fi; echo "echo *FvwmButtons: Fore $fg"; echo "echo *FvwmButtons: Back $bg"'

Watch the semicolons.

I didn't test too carefully, to leave you some fun.

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Fri, 04 Apr 2003 22:58:07 -0500

Dan Espen <[email-masked]> writes:
> PipeRead 'if [ -r $HOME/.fvwmColors ] ; then  fg=`cat $HOME/.fvwmColors | cut
>  -f3 -d" "`; bg=`cat $HOME/.fvwmColors | cut -f4 -d" "`; else fg=AntiqueWhite
>  bg=RoyalBlue;  fi; echo "echo *FvwmButtons: Fore $fg"; echo "echo *FvwmButto
> ns: Back $bg"'
> 
> Watch the semicolons.
> 

And I didn't remember to remove the echos I stuck in there for testing
either.

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 5 Apr 2003 13:14:03 +0000

> What's the best way to get this behaviour? I tried using a PipeRead:

The best way is to use colorsets, of course.

  Colorset 10 fg AntiqueWhite, bg RoyalBlue
  *FvwmButtons: Colorset 10

This way you may change the colors of FvwmButtons on the fly without
restarting it, and reuse the same colors in other places.

  Colorset 10 fg yellow, bg darknavy

I would do something like this to solve you problem:

SetEnv COLOR_FILE $[HOME]/.fvwmColors
PipeRead "test -r $[COLOR_FILE] && echo Colorset 10 fg `awk '{ print $3 }' $[COLOR_FILE]`, bg `awk '{ print $4 }' $[COLOR_FILE]`"

Regards,
Mikhael.

---

From: Scott Smedley <[email-masked]>
Date: Sun, 6 Apr 2003 15:28:03 +1000

> PipeRead 'if [ -r $HOME/.fvwmColors ] ; then  fg=`cat $HOME/.fvwmColors | cut -f3 -d" "`; bg=`cat $HOME/.fvwmColors | cut -f4 -d" "`; else fg=AntiqueWhite bg=RoyalBlue;  fi; echo "echo *FvwmButtons…

Ah, thanks.

Incidentally, I had to convert the `cat ...` syntax to $(cat ...)
to get it to work with FvwmM4 preprocessing.

SCoTTie! :)

---

From: SCoTT SMeDLeY <[email-masked]>
Date: Sun, 6 Apr 2003 14:45:06 +1000

> The best way is to use colorsets, of course.

Ah, thanks. Been playing with this all morning - nice feature. I
couldn't use Colorsets with TitleStyle though. No biggie, I can still
change the TitleStyle dynamically anyway.

SCoTTie :)
-- 
[email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Sun, 6 Apr 2003 07:52:29 +0000

On 06 Apr 2003 14:45:06 +1000, SCoTT SMeDLeY wrote:
> couldn't use Colorsets with TitleStyle though.

This is possible in the latest 2.5.x releases.

> No biggie, I can still change the TitleStyle dynamically anyway.

Regards,
Mikhael.