I have to (scriptly) take screenshots of windows, some of which may be partially or fully hidden by other windows. Of course, in such a case the screenshot is useless, and I'd rather print a warning.
Unfortunately I'm not in a situation where I can use a Window Manager which prints even hidden or minimized windows — I'm stuck with an old KDE.
I can use e.g. xwininfo -id <windowid> | grep "Map State"
to determine if the window IsViewable
(which basically means standard screenshot tools won't complain), but I can't seem to figure out how to determine if the window is overlapped by other windows and how much it is (then I could print the warning if, say, less than 50 % of the window are visible).
(As I'm actually trying to workaround it because I don't believe it exists, of course I won't complain if anyone points me to an easy method to e.g. "virtually redraw" windows so that the screenshot is worth it…)
wmctrl
. – derobert Oct 1 '13 at 16:45