#!/usr/bin/perl use strict; use warnings; use X11::GUITest qw(FindWindowLike GetWindowName GetWindowPos IsWindow IsWindowViewable GetParentWindow GetWindowFromPoint GetRootWindow MoveWindow ResizeWindow); my @exclude=("KDE Desktop","kwin","kicker"); #FIXME: read from properties or something my $sw=1024; my $sh=768; my $totalh=1368; my $res=5; sub printwindowprops($) { (my $id)=@_; my $name=GetWindowName($id); if (!$name) { return; } if (grep {$name eq $_} @exclude) { return; } (my $x,my $y,my $w,my $h)=GetWindowPos($id); if ($x<0) { return; } if ($x>$sw) { return; } if ($y<0) { return; } if ($y>$sh) { return; } my $win=IsWindow($id); my $view=IsWindowViewable($id); my $parent=GetParentWindow($id); if (!$view) { return; } print "$id $name $x $y $w $h $win $view $parent\n"; my $newy=$y+$sh; if ($newy>($totalh-50)) { $newy=$totalh-50; } my $ok=MoveWindow($id,$x,$newy); (my $x2,my $y2,my $w2,my $h2)=GetWindowPos($id); if (!$ok) { print "move failed unexpectedly\n"; return; } if ($y2!=$y) { return; } print "move failed, trying to resize first\n"; ResizeWindow($id,int($sw*0.9),int(($totalh-$sh)*0.9)); my $ok2=MoveWindow($id,$x,$newy); } my @ids=FindWindowLike(""); foreach my $id (@ids) { printwindowprops($id); }