Subject: FVWM: 'Maximize grow grow' automatically.

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Mon, 29 Jul 2002 03:48:51 -0600

Hello,

Often I find it convenient to open four xterms and start doing work with
them, so I have this menu item on one of my menus:

+ "4 XTerms" Exec exec xterm & xterm & xterm & xterm

But, unfortunately, they do not cover the entire screen, so I have to
'Maximize grow grow' them all as soon as they open. Since this is always
the first thing I do with them, and I've never done anything else, I
figured I might as well get fvwm to grow them for me. Would it be
possible to do this, without affecting the behavior of the other xterms
that I open individually?

Thanks in advance.

-- 
Rob 'Feztaa' Park
http://members.shaw.ca/feztaa/
--
She cried, and the judge wiped her tears with my checkbook.
		-- Tommy Manville
--
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: Dominik Vogt <[email-masked]>
Date: Mon, 29 Jul 2002 11:54:38 +0200

> that I open individually?

Try this:

  addtofunc XtermCreateGrow
  + i exec exec xterm
  + i wait xterm
  + i next (xterm) maximize grow grow

  addtofunc Create4XTerms
  + I XtermCreateGrow
  + I XtermCreateGrow
  + I XtermCreateGrow
  + I XtermCreateGrow

  AddToMenu foobar
  + "4 XTerms" Create4XTerms

However, it's really better to provide the xterms with the proper
geometry manually.  The "Next" command can not guarantee that the
command is applied to the correct window.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, mail: [email-masked], phone: 0721/91374-382
Schlund + Partner AG, Erbprinzenstr. 4-12, D-76133 Karlsruhe
--
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: "Rob 'Feztaa' Park" <[email-masked]>
Date: Mon, 29 Jul 2002 15:29:27 -0600

Alas! Fvwm spake thus:
> > Would it be possible to do this, without affecting the behavior of
> > the other xterms that I open individually?
> 
> Try this:
> 

Didn't work; the end result is that one already opened xterm grew,
another opened and grew, a second opened and did nothing, and then a
third and fourth opened which both grew.

Aside from the fact that it's growing the wrong ones, it's also growing
them before the others open which results in one fully maximized behind
some others grown into odd shapes.

> command is applied to the correct window.

Aw, but manually is too hard! That means I'd have to hardcode the size,
which would be a PITA if I ever change X resolutions.

> Bye

Thanks anyway, I guess I'll go back to clicking.

Last night I dreamed I ate a ten-pound marshmallow, and when I woke up
the pillow was gone.
		-- Tommy Cooper

---

From: "S. Anderson" <[email-masked]>
Date: Mon, 29 Jul 2002 21:53:46 -0600

On Mon, Jul 29, 2002 at 03:29:27PM -0600, Rob 'Feztaa' Park wrote:
> ...
how bout starting them all first?
destroyfunc XtermCreateGrow
addtofunc XtermCreateGrow
+ i exec exec xterm -T xterm1
+ i exec exec xterm -T xterm2
+ i exec exec xterm -T xterm3
+ i exec exec xterm -T xterm4
+ i wait xterm4
+ i next (xterm1) maximize grow grow
+ i next (xterm2) maximize grow grow
+ i next (xterm3) maximize grow grow
+ i next (xterm4) maximize grow grow
XtermCreateGrow

not sure if the '-T' is necisito.

sa

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Mon, 29 Jul 2002 23:28:10 -0600

> + i next (xterm4) maximize grow grow

Argh! I had this working, then I changed something, changed it back, and
now it won't work! *sigh*

I'll wrestle with it some more, I guess.

-- 
Rob 'Feztaa' Park
http://members.shaw.ca/feztaa/
--
How do I type "for i in *.dvi do xdvi i done" in a GUI?
(Discussion in comp.os.linux.misc on the intuitiveness of interfaces.)
--
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: Dominik Vogt <[email-masked]>
Date: Tue, 30 Jul 2002 10:46:43 +0200

> third and fourth opened which both grew.

Well, it's not clear what you expect of growing.  It works like
this:  it takes a window and extends its four borders until it
hits the border of a different window from the outside.  As you
can imagine, that algorithm doesn't work well with overlapping
windows.  Usually it doesn't make sense at all to maximize more
than one window on a single page, and it gets worse with "grow".

Actually, why do you think you need "grow"?  What is the layout of
your desktop before the xterms are created and how would you like
it with them?  Please draw ASCII graohics to illustrate your
needs.

> which would be a PITA if I ever change X resolutions.

I can't speak for you, but the only time I change the resolution
is when I get a new machine.  However, it *is* possible to write
these lines in a way that takes care of the dispülay resolution by
invoking a shell script via PipeRead.  I can write one that
satisfies your need once I understand what you want to do.

Bye

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 30 Jul 2002 16:30:40 +0000

> not sure if the '-T' is necisito.

Yes, it is necessary to distinguish them, because Rob wants to grow xterms
in the certain order if I understand.  -n is stronger, -name is even more.

When Wait above is passed it is not guaranteed that 4 xterms are already
up, it is only guaranteed that only one xterm4 is up. And if you group all
four Wait together it may hang from time to time. This works (note -g):

  DestroyFunc Xterm4CreateGrow
  AddToFunc   Xterm4CreateGrow
  + I Exec exec xterm -n xterm1 -g +0+0
  + I Wait xterm1
  + I Exec exec xterm -n xterm2 -g -0+0
  + I Wait xterm2
  + I Exec exec xterm -n xterm3 -g +0-0
  + I Wait xterm3
  + I Exec exec xterm -n xterm4 -g -0-0
  + I Wait xterm4
  + I Next (xterm1) Maximize grow grow
  + I Next (xterm2) Maximize grow grow
  + I Next (xterm3) Maximize grow grow
  + I Next (xterm4) Maximize grow grow

Regards,
Mikhael.

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Tue, 30 Jul 2002 18:17:32 -0600

Alas! Fvwm spake thus:
> Well, it's not clear what you expect of growing.

I expect it to utilize as much screen space as possible without
overlapping. The problem here is that the windows are being grown too
soon; they need to wait for the other windows to be open before they are
grown.

> Usually it doesn't make sense at all to maximize more

I totally disagree with this statement. I have here a situation in which
it makes perfect sense to grow four windows (though, in reality, the
top-left one stays the same size). I've yet to see a situation in which
fully maximizing more than one window makes any sense ;)

> Actually, why do you think you need "grow"?

Because then I don't have to bother figuring out how big they ought to
be, and I can use one command to size any window perfectly, and they
don't overlap. It's all about flexibility and convenience.

> What is the layout of your desktop before the xterms are created and
> how would you like it with them?  Please draw ASCII graohics to
> illustrate your needs.

I think I need grow, because I have wasted screen space that I want to
be used by xterms. Here is what my desktop looks like before growing:

+------------------------+
|xterm    |xterm    |    |
|         |         |    |
|         |         |    |
+---------+---------+    |
|xterm    |xterm    |    |
|         |         |    |
|         |         |    |
+---------+---------+    |
|                        |
|     root               |
|                        |
+------------------------+

And I want it to look like this:

+------------------------+
|xterm    |xterm         |
|         |              |
|         |              |
+---------+--------------+
|xterm    |xterm         |
|         |              |
|         |              |
|         |              |
|         |              |
|         |              |
|         |              |
+---------+--------------+

Understand now? The original problem was that it was growing them in the
wrong order and the wrong time, and the result was oddly grown windows,
not in the way that I wanted them. Manually growing each one after it's
open does exactly what I want, I was just looking for a way to automate
it.

> is when I get a new machine.

Yes exactly, I'm getting a new machine soon, and I'd rather not have to
re-figure out what size the xterms need to be when "Maximize grow grow"
is right there for me to use.

> However, it *is* possible to write these lines in a way that takes
> care of the display resolution by invoking a shell script via
> PipeRead.  I can write one that satisfies your need once I understand
> what you want to do.

I just want to eliminate wasted screen space, so I can see as little of
the root window as possible, with four xterms that are as large as
possible without overlapping.

-- 
Rob 'Feztaa' Park
http://members.shaw.ca/feztaa/
--
You can measure a programmer's perspective by noting his attitude on
the continuing viability of FORTRAN.
		-- Alan Perlis
--
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: "Rob 'Feztaa' Park" <[email-masked]>
Date: Tue, 30 Jul 2002 18:33:05 -0600

>   + I Next (xterm4) Maximize grow grow

Ok, you've almost got it! ;)

This works, except that the second (or later) time I run it, whichever
xterm had the mousecursor over it doesn't get grown, and an xterm with
the same name on another desk gets ungrown. The ungrown thing could be
avoided with "Maximize true grow grow", but it doesn't change the fact
that the current window is not grown. Mostly this just leads to odd
results like this:

+---------+              |
|xterm    |              |
|         +--------------+
|         |xterm         |

But it's still maximum utilized screen space, so I'm not really
complaining ;)

Thanks.

-- 
Rob 'Feztaa' Park
http://members.shaw.ca/feztaa/
--
We come to bury DOS, not to praise it.
(Paul Vojta, [email-masked], paraphrasing a quote of Shakespeare)
--
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: Christian MICHON <[email-masked]>
Date: Wed, 31 Jul 2002 08:55:10 +0200 (CEST)

What about using FvwmRearrange module ?

Try this:
AddToFunc Create4XTerms
+ "I" All Iconify on
+ "I" Exec exec xterm -g +0+0
+ "I" wait xterm
+ "I" Exec exec xterm -g -0+0
+ "I" wait xterm
+ "I" Exec exec xterm -g +0-0
+ "I" wait xterm
+ "I" Exec exec xterm -g -0-0
+ "I" wait xterm
+ "I" Module FvwmRearrange -tile -v -m -mn 2 0 0 100 100

Pitfalls:
 -> it needs to iconify all windows present on the current desk for the
vertical FvwmRearrange to work
 -> you may look more into FvwmRearrange parameters to improve the code
 -> you may want to add names to your terminals ( i usually do not )

Hope this is finally what you looked for. Thanks for this idea anyway.
It's now part of my .fvwm2rc ! ;)

Rgds,
Christian

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
--
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: Dominik Vogt <[email-masked]>
Date: Wed, 31 Jul 2002 10:47:22 +0200

On Tue, Jul 30, 2002 at 06:33:05PM -0600, Rob 'Feztaa' Park wrote:
> the same name on another desk gets ungrown.

The function relies on unique window names.  If you run it a second
time before all those windows were closed, it fails.  Try

  + I (xterm1, CurrentDesk, CurrentPage) Maximize grow grow

Or give the xterms unique names:

  + I Exec exec xterm -n "xterm_+$[vp.x]+$[vp.y]@$d" -g +0+0
  ...
  + I (xterm_+$[vp.x]+$[vp.y]@$d) Maximize grow grow
  ...

Bye

Dominik ^_^  ^_^