2 # FvwmCommand example - move a group of windows
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 open( FCM
, "FvwmCommand -m -i3 |" ) || die "$! FvwmCommand";
23 open( FCC
, ">$ENV{'HOME'}/.FvwmCommandC" ) || die "FCC";
24 select( FCC
); $| = 1;
25 select( STDOUT
); $| = 1;
28 if( /^0x(\S+) frame +x (\d+), y (\d+)/ ) {
29 # check if a member window is moved
30 ($id,$x,$y) = ($1,$2,$3);
32 if( defined $Config{$id} ) {
33 foreach $w (keys %Config) {
34 $newx = $x + $Config{$w}{'x'}-$Config{$id}{'x'};
35 $newy = $y + $Config{$w}{'y'}-$Config{$id}{'y'};
42 print FCC
"windowid 0x$w move ${newx}p ${newy}p\n";
44 # ignore - pixel info is the last info for move
46 last if /^0x$w pixel/;
48 select(undef,undef,undef,0.1);
60 open( FCM
, "FvwmCommand -i2 send_windowlist |" ) || die "$! FvwmCommand";
62 if( /^0x(\S+) (id|window) +(.*)/ ) {
64 }elsif( /^0x(\S+) frame +x (\d+), y (\d+)/ ) {
65 $Config{$1}{'x'} = $2;
66 $Config{$1}{'y'} = $3;
72 foreach $w (keys %Config) {
74 $Config{$w}{'grp'} = 0;
77 print "\nWhich windwow to group (* for all, ENTER to Start)?\n";
78 foreach $k (keys %win) {
79 $mark = $Config{$win{$k}}{'grp'} ?
'X':' ';
80 print "($k) ($mark) $Config{$win{$k}}{'window'}\n";
83 system "stty -icanon min 1 time 0";
89 $Config{$_}{'grp'} = 1;
91 }elsif( $c eq "\n" ) {
93 }elsif( !grep( /$c/,keys %win) ) {
94 print "\aUndefine process\n";
96 $Config{$win{$c}}{'grp'} = ! $Config{$win{$c}}{'grp'};
100 print "Group move on effect\n";
101 foreach $w (keys %Config) {
102 delete $Config{$w} if $Config{$w}{'grp'}!=1;