I can get X and Y of the active window with xdotool getwindowgeometry --shell $(xdotool getactivewindow). How do I do a backwards process - find window id given its X and Y? I'm only interested in the topmost window, not the one that may be hidden underneath the one on top.
Asked
Active
Viewed 803 times
4
Fluffy
- 2,047
- 3
- 15
- 18
-
Do you want the id of the active window or of the one at a particular position irrespective of whether it is active? – terdon Jan 18 '15 at 18:08
-
@terdon, second - otherwise I'd just use `getactivewindow` – Fluffy Jan 19 '15 at 08:46
1 Answers
6
I've figured it out myself:
xdotool mousemove 500 100 getmouselocation --shell mousemove restore
This briefly moves the mouse to the specified position (x=500, y=100 in this example), prints WINDOW which is the windowid on top, then moves the mouse back.
This is probably not the intended usage of mousemove, but I could not find any better way to do what I wanted.
Fluffy
- 2,047
- 3
- 15
- 18