Re: FVWM: maximum # of windows

From: Mikhael Goikhman <migo_at_cortext.co.il>
Date: Tue, 5 Sep 2000 19:38:09 +0200

On 05 Sep 2000 15:47:16 -0800, Czarina Caro L. Tablante 1995-24644 wrote:
>
> I need to make sure the # of netscape windows a user has at any
> single session is limited to, say, 5. how do i make sure that this is
> the case? i have other windows, there are sxpms which would be
> included if i counted the # of windows open. i need to set a maximum
> for the netscape windows only.

Well, this is possible with a little shell+fvwmrc programming.
To find how many Netscape (or other) windows are open execute:

  xwininfo -display :0 -tree -root | grep Netscape | wc -l

Use 'grep -v 1x1+0+0' or similar to ignore the first Netscape window.
Now there are 2 choices for you.

1) Define FvwmEvent with add_window like described here (for 2.3 and 2.2):

  http://www.hpc.uh.edu/fvwm/archive/0006/msg00382.html
  http://www.hpc.uh.edu/fvwm/archive/0006/msg00393.html

Your add_window callback can be like this (works in the betas only):

  + I PipeRead `verify-window "$w" "$n" "$r" "$c"`

verify-window is your shell script, which gets an id of a new window
as the first parameter, name, resource name and resource class as the next
parameters. Now, do what you want with this window: leave it, kill it.
If you want to leave it, just do not output anything, otherwise print
this fvwm command to the standard output: WindowId $w Delete.

2) You can run a cron job, which counts windows and kills (if needed)
some of them (I hate to suggest this fascist mode, poor users). :-)

xwininfo can give you id's of windows, experiment with:

  xwininfo -tree -root | grep Netscape | sed 's/ */ /g' | cut -d" " -f2

To kill (dangerous) a window giving its id, execute:

  xkill -id 0x1215f2e

Just tried xkill, it does not work well. I.e. it kills entire netscape,
rather than only one window, it does not use X delete protocol.

There is an alternative to xkill. Run FvwmCommandS in user's StartFunction
and then execute a shell command from the cron job:

  FvwmCommand 'WindowId 0x1215f2e Delete'

Regards,
Mikhael.
--
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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Tue Sep 05 2000 - 12:39:56 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:51 BST