2

I'm using FVWM2, which allows me to send the current X11 WindowID to any script I like through window decoration bindings.

So a click might execute a CLI program in the following form:

bash# example.pl

In this case WindowID refers to an already existing window. Not one that is generated by example.pl.

If example.pl a a screen capture utility for example, it will need the X11 geometry string of the window identified by , to run the capture. I can parse this data from xwininfo output. But that is not portable.

How do I get the X11 geometry from a WindowID, programatically, in Perl?

Vorideo
  • 19
  • 1

1 Answers1

2

You can use X11::GuiTest to get various pieces of information about the X11 window.

In your case, the appropriate command would be GetWindowPos(windowID):

use strict; use warnings;
use X11::GuiTest qw/GetWindowPos GetRootWindow/;

...

my ($x, $y, $width, $height, $borderWidth, $screen) = GetWindowPos(GetRootWindow());

$width and $height are the dimensions of the window, $borderWidth is the border on it, and $screen is the screen that it is on.

i alarmed alien
  • 9,412
  • 3
  • 27
  • 40