I am trying to write a program that tracks when the active window changes using Xlib. I am have trouble figuring out the best way to do this. These are my ideas so far:
I've been looking for "active windows change event grabber" as well. What I use in mean time (and might be helpful for you) is combination of xdotool and xwininfo.