I use
X11::GUITest for this stuff. I used to like the KGS Go server, but I hated the way the client interacted with my linux desktop. WMS made several terrible design decisions that made it somewhat less portable than Java programmers pretend their programs should be...
... so I wrote a program to find KGS windows and move them back onto my desktop (from off the screen) and/or put them where I want them to go (instead of whatever random position WMS calculated).
I won't cut and paste the whole thing, but here's basically how it worked:
use strict;
use warnings;
use X11::GUITest ':ALL';
my $cur = GetInputFocus;
sub onscreen {
my ($x, $y) = @_;
return 0 if $x > 1280 or $x < 0;
return 0 if $y > 1024 or $y < 0;
return 1;
}
for(;;) {
my $root = GetRootWindow;
for my $window (grep {defined $_->{n}} map {{id=>$_, n=>GetWindowN
+ame($_)}} GetChildWindows($root)) {
if( $window->{n} =~ m/Room List/ ) {
my ($x, $y, $w, $h) = GetWindowPos($window->{id}); # warn
+"\$x=$x, \$y=$y, \$w=$w, \$h=$h";
my ($ex, $ey, $ew, $eh) = (1, 19, 1076, 879);
if( onscreen($x, $y) ) {
unless( $x == $ex and $y == $ey ) {
print "Moving room list to ${ex}x$ey\n";
MoveWindow($window->{id}, $ex, $ey);
}
unless( $w == $ew and $h == $eh ) {
print "Resizing room list to ${ew}x$eh\n";
ResizeWindow($window->{id}, $ew, $eh);
}
}
}
}
sleep $d;
}
Also, I may not understand Gnome/kde vs Metacity/sawfish/openbox -- but I don't think Gnome moves windows around, that's metacity. Metacity doesn't handle the panels, that's gnome... maybe I'm way off.