jordansissel / xdotool

fake keyboard/mouse input, window management, and more
Other
3.23k stars 318 forks source link

Can xdotool print full window info in a tab separated list? #141

Open sleekweasel opened 8 years ago

sleekweasel commented 8 years ago

It would be really helpful if there were a 'getwindowinfo' command that printed a columnar format for easy machine parsing (tab separated, since xdotool is used in shell quite a lot, and 'cut' likes tabs), and included id, geometry, and things like window class (because I have no idea how to find a window's class, but it seems better to search for class rather than title sometimes).

jordansissel commented 8 years ago

For window geometry and id, the getwindowgeometry command will do this. It has a --shell flag for something machine-friendly (especiallly shell):

/xdotool getwindowfocus getwindowgeometry --shell
WINDOW=2097165
X=0
Y=0
WIDTH=499
HEIGHT=316
SCREEN=0

For getting the window class, I don't think this is available in xdotool, yet, but could be added.

as a workaround, you can use xprop to find the window class.

% xprop -id 2097165 WM_CLASS
WM_CLASS(STRING) = "xterm", "XTerm"