cx11xcbewmh

How to monitor active window changes using xcb?


I'm trying to find a way to monitor when the _NET_ACTIVE_WINDOW property changes. Right now I'm polling every 1 second to update the current active window. I know that there's a way to get events about this, I've seen references to it, but I can't seem to find any code (that I can understand) that explains how to do it.


Solution

  • If you set PropertyChange mask on root window you'll start getting PropertyNotify events to your code. See example in my answer here: Linux get notification on focused gui window change