Disclaimer: I know there is a very similar question on this topic.
I am trying to get exactly the same result that NoozNooz42 described here. However mdma answer doesn't fit my needs, because I'm interested in doing the same on linux. Preferrably with gnome, if it matters. So using JNA with user32 library is not a option here (or is it?).
Any suggestions will be great, I couldn't find almost anything on the topic.
P.S. The only thing I have found is wmctrl command (I could call and parse it in java eventually) that lists windows but doesn't give me any information about the z-order.
Update: It would be perfect if I could get a notification/callback when the z-order changes.