3

I am writing a python script to resize and organize windows, just like the grid plugin does in compiz-fusion(except that I am on Debian Wheezy).

I am using xrandr and wmctrl to get the resolutions of my two screens and compute custom sizes for windows (split horizontally, vertically, etc...):

  • xrandr tells me how many screen I have and their resolutions
  • wmctrl gives me original sizes of windows and their location (on which workspace they are displayed)

Unfortunately my 2 screens don't have the same resolution at all, so the only information I am missing is: on which screen the windows is currently displayed so that I can compute new sizes that fit gracefully in this screen.

Is there any command/program that could get this info ?

1
  • FWIW I had a look at xdotool but unfortunately it is not aware of the dual screen setup, all it can see is a single big screen. Indeed xdotool getmouselocation always displays screen:0 even if I move my mouse around both screen...
    – n0p
    Jun 4, 2014 at 9:23

1 Answer 1

0

Ok so looking at this answer, it seems that there is no way of doing this directly (and my comment about xdotool tends to confirm that), all we can do is find a hacky solution.

I am thinking about this:

  • Get the window geometry via wmctrl (coordinates of the window i.e. its top left corner)
  • Compare it with screen resolutions and deduce on which screen it is displayed

I'm still open to alternatives solution though :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .