2 # FvwmCommand example - auto raise small windows
3 # arg1 - size ( w * h in pixel) (default 60000)
4 # arg2 - delay (second) (default 1)
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 open( FCM
, "FvwmCommand -m -i3 send_windowlist |" ) || die "FCM";
21 open( FCC
, ">$ENV{'HOME'}/.FvwmCommandC" ) || die "FCC";
23 select( FCC
); $| = 1;
24 select( STDOUT
); $| = 1;
39 LOOP1
:while( <FCM
> ) {
40 if( /^0x(\S+) frame .*width (\d+), height (\d+)/ ) {
41 $Config{$1}{'area'} = $2 * $3;
42 }elsif( /^0x(\S+) (focus change|end windowlist)/ ) {
45 # delay longer than FvwmAuto
46 select(undef,undef,undef,$Delay);
48 foreach $w (keys %Config) {
49 if( $Config{$w}{'area'} < $Size ) {
50 print FCC
"windowid 0x$w Raise\n";
54 last if /^0x$w raise/;
55 redo LOOP1
if /^0x\S+ focus change/;
57 select(undef,undef,undef,0.1);