Bugfixes and improvements
This commit is contained in:
@ -86,12 +86,34 @@ class Window
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWindowSize()
|
||||
{
|
||||
exec("xdotool getwindowgeometry {$this->windowId}", $output, $status);
|
||||
$str = join("\n",$output);
|
||||
|
||||
if (preg_match('/Geometry: ([0-9]+?)x([0-9]+?)$/i', $str, $match)) {
|
||||
return (object)[
|
||||
'width' => intval($match[1]),
|
||||
'height' => intval($match[2])
|
||||
];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setWindowSize($width, $height)
|
||||
{
|
||||
exec("xdotool windowsize {$this->windowId} {$width} {$height}");
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function dump()
|
||||
{
|
||||
printf("Window: (id=0x%08x)\n Title: %s\n Visible: %s\n",
|
||||
$size = $this->getWindowSize();
|
||||
printf("Window: (id=0x%08x)\n Title: %s\n Visible: %s\n Size: %dx%d\n",
|
||||
$this->windowId,
|
||||
$this->windowTitle,
|
||||
$this->isVisible?'true':'false'
|
||||
$this->isVisible?'true':'false',
|
||||
$size->width, $size->height
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user