Python – Which Window Has Current Focus?


I'd like to know (programmatically) which window has current focus. Is there a window-manager independent way of discovering that?

Otherwise, how does one determine which window has focus in Compiz or Metacity?

Best Answer

What you want is libwnck (if you're just interested in windows) or libbamf (if you're interested in windows and the applications that own them).

Related Question