Subject: FVWM: .fvwmrc files and multiheaded displays

From: Brand Hilton <[email-masked]>
Date: Thu, 20 May 1999 17:05:22 -0500

I hope this is a simple question, but my efforts to answer it have
been fruitless so far.

I just got a second monitor on my Sun.  I understand that there is a
separate fvwm managing each monitor.  No problem.  However, what I
want to do is run a slightly different .fvwmrc in each of these
processes, and I can't figure out how to do it.

A simple if-then-else construct in the config file would solve my
problems.  I could just key off the $DISPLAY environment variable.
Alternatively, if I could find a way to use $DISPLAY as part of the
filename in a Read command (like "Read .fvwmrc$DISPLAY" or something),
that would work, too.  But, no luck.

Any ideas?  Thanks in advance.

-- 
 _____ 
|///  |   Brand Hilton  [email-masked]
|  ADC|   ADC Telecommunications
|_____|   Richardson, Texas
--
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: Thu, 20 May 1999 20:24:03 -0400

> Any ideas?  Thanks in advance.

In general, to get conditional processing in your config file,
you would use the FvwmCPP or FvwmM4 modules.  The PipeRead command
may help, or fvwm2 can be invoked with command line args, like:

fvwm2 -f .fvwmrc$DISPLAY

--
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: Brand Hilton <[email-masked]>
Date: Fri, 21 May 1999 14:15:44 -0500

Many thanks to Dan for putting me on the right path to solve my
problem.  I thought I'd share what I ended up doing in case someone
else might benefit from it.

The key problem is that I need to do different things based on the
value of the DISPLAY environment variable.  Dan suggested FvwmM4 and
FvwmCpp.  Either of these would have worked great, if only FVWM passed
the value of DISPLAY down to them.  Unfortunately, it doesn't.
(Consider this a request for feature, if you wish :-)

Dan also mentioned PipeRead, which turned out to be the best thing.  I
just wrote a shell script that spits different things to standard
output based on the value of DISPLAY.  Here it is, in case anyone's
interested:

  #!/bin/sh

  if [ "$DISPLAY" = ":0.1" ] 
  then
    cat <<'EOT'
  AddToFunc InitFunction    "I"  Exec exec xconsole -geometry 800x100-1+0 -iconic &
  +                         "I"  Exec exec xterm -geometry 100x50+71-1 -T $HOSTNAME -n $HOSTNAME &
  +                         "I"  Exec exec xterm -geometry 80x50-1-1 -T $HOSTNAME -n $HOSTNAME &
  #+                         "I"  Exec exec netscape45 -install -geometry 1072x872+70+900 &
  EOT
  fi

  ###################### button-bar ################################

  cat <<'EOT'
  # Colors
  *FvwmButtonsFore Black
  *FvwmButtonsBack #908090

  # Font
  *FvwmButtonsFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*

  # Geometry - really likes to pick its own size, but giving a position is OK

  EOT

  if [ $DISPLAY = ':0.1' ]
  then
    echo "*FvwmButtonsGeometry +0-1\n\n"
  elif [ $DISPLAY = ':0.0' ]
  then
    echo "*FvwmButtonsGeometry -1-1\n\n"
  fi

  cat <<'EOT'
  # Layout: specify rows or columns, not both
  *FvwmButtonsColumns 1

  # Define the buttons to use.....

  *FvwmButtons(Icon xterm.xpm, Action 'Exec xterm -T $HOSTNAME -n $HOSTNAME')

  EOT

  if [ $DISPLAY = ':0.1' ]
  then
    cat <<'EOT'
  *FvwmButtons(Swallow(UseOld,NoRespawn) perfmeter1 `Exec exec $OPENWINHOME/bin/perfmeter -t load -g -S -V -Wn -s 2 -name perfmeter1 -bg '#908090'`)
  *FvwmButtons(Swallow(UseOld,NoRespawn) xbiff `Exec exec $OPENWINHOME/bin/xbiff -bg '#908090'`)
  *FvwmButtons(Icon LetterEnvelope.xpm, Action 'Exec xterm -geometry 80x50 -T mutt -n mutt -e mutt')
  EOT
  fi

  cat <<'EOT'
  *FvwmButtons - whatever Swallow "FvwmPager" Module FvwmPager 0 0
  EOT

What this does is, on my main monitor (:0.1), fvwm starts up two
xterms.  The button bar is in the lower left corner and has five
buttons: xterm, xperfmon, xbiff, mutt, and pager.  On the auxiliary
monitor (:0.0), the button bar is in the lower right corner and has
only two buttons: xterm and pager.

That's about it.  Thanks again, Dan, for the help.

---

From: Dan Espen <[email-masked]>
Date: Fri, 21 May 1999 15:49:57 -0400

> (Consider this a request for feature, if you wish :-)

I don't use M4 or CPP, but I think this would work:

fvwm2 -cmd "FvwmCpp -DDISPLAY=$DISPLAY .fvwm2rc"

Maybe we need some more man page examples.

> output based on the value of DISPLAY.  Here it is, in case anyone's
...

Yep, PipeRead is pretty cool.

> That's about it.  Thanks again, Dan, for the help.

Thanks.