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.

-Paul


In reply to Re: Moving and resizing application in X Window Manager by jettero
in thread Moving and resizing application in X Window Manager by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.