I would like to find out if a window has focus. I am using pyGTK and would be helpful to us that but have got some Xlib in my script aswell.
I've used:
self.window.add_events( gdk.FOCUS_CHANGE_MASK ) # It took me ages to research this self.window.connect("focus-in-event", self.helloworld)
but this gives me the event every time the window is being focused in, even if it is already focused. I want it to tell me just if it isn't focused before