Subject: FVWM: restricting oversize windows

From: Perry Hutchison <[email-masked]>
Date: Fri, 3 Jan 2003 12:46:00 -0800 (PST)

Is it possible to configure 2.2.4 to restrict windows to the size of
the screen, even if -geometry requests larger?

Motivation:  I want an xterm just tall enough to display an entire
file, but no taller than the screen.  This:

  xterm -geometry "80x`wc -l < $f | tr -d ' '`" +sb -sl 0 -e less $f

gets the file length almost right -- it's off by one line because it
doesn't allow for the "less" command/status line at the bottom -- but
if the file is longer than 89 lines the window doesn't fit on the
screen.  I could write a more complicated script, except that there's
no immediately-obvious way for a script to determine the maximum line
count for whatever display it might happen to be running on.
--
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, 03 Jan 2003 16:10:39 -0500

> the screen, even if -geometry requests larger?

I don't think so.

> file, but no taller than the screen.  This:

For that, I like to use a keybinding:

Key F1		A	M	Maximize 0 100

> count for whatever display it might happen to be running on.

In 2.4.x fvwm sets $[vp.height] which you could use in PipeRead.

If, for some reason, you don't want to upgrade you can pull the
screen height out of xdpyinfo.

That would give you screen height in pixels, but theres still no
way that I know of to know the height of your font in pixels.
I guess you'd have to hard code that.

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

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 3 Jan 2003 22:03:54 +0000

> count for whatever display it might happen to be running on.

Use "xwininfo -root" to get the screen size, then substruct decorations
(border size, title height), then substruct xterm's scroll bar, then
divide by the font used in xterm (7x14), you should get the needed
geometry for xterm.

Or just do the right thing and run the latest stable 2.4.14, then do:

  Style XTerm MaxWindowSize $[vp.width]p $[vp.height]p

Regards,
Mikhael.

---

From: Dan Espen <[email-masked]>
Date: Fri, 03 Jan 2003 17:15:08 -0500

>   Style XTerm MaxWindowSize $[vp.width]p $[vp.height]p

Gee, I did search the man page before I answered.
(I searched for "size" but I guess I just got too many hits.)

It looks like the above command equivalent to:

Style XTerm MaxWindowSize 100 100

---

From: wang yin <[email-masked]>
Date: Sat, 4 Jan 2003 09:45:21 +0800

> the screen, even if -geometry requests larger?
I can restrict the size of any windows to half the screen size with a 

Style mywindow MaxWindowSize 50 50

I'm using 2.5.4. I don't know if it works for 2.2.4.
> count for whatever display it might happen to be running on.
You can use a smaller font :)

-- 
Wang Yin
DA Lab, Tsinghua University,
100084
Beijing China

---

From: Perry Hutchison <[email-masked]>
Date: Fri, 3 Jan 2003 22:39:17 -0800 (PST)

> > file, but no taller than the screen ...
...
>   Style XTerm MaxWindowSize $[vp.width]p $[vp.height]p

That is the sort of capability I had in mind.

For the sake of the archives, this is what I've ended up with for 2.2.4
using xwininfo.  (My xterm seems to be using a 13-pixel font.)

  #!/usr/local/bin/bash
  maxl=`(xwininfo -root | sed -n -e 's/  Height: //p' ; echo 35 - 13 / p) | dc`
  xterm -geometry \
      "80x`(wc -l < $1 ; echo \"1 + d [$maxl p q] sa $maxl <a p q\") | dc`" \
      +sb -sl 0 -title $1 -n `basename $1` -e less $* &
--
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].