Is there any way to get a list of all windows that are open at present and see what window is at the top (i.e. active?) from Python?
This is using Gnome on Ubuntu Linux.
wnck looks like it might do this, but it's very lacking in documentation.
import wnck
screen = wnck.screen_get_default()
window_list = screen.get_windows()
active_window = screen.get_active_window()
See also Get active window title in X, and WnckScreen in the documentation. Other questions containing wnck have useful code samples.