I just started using PyGI (on Ubuntu Natty), although I have never used pygtk before.
I have used wnck in a wxPython program though, and it was easy enough to get a list of currently opened windows. From PyGI, the window list is always empty.
relevant code bits:
from gi.repository import Gtk, Wnck
while Gtk.events_pending():
Gtk.main_iteration()
#... in my app class...
screen = Wnck.Screen.get_default()
wins = screen.get_windows()
with that, wins == [].
Thanks!
You need to call
screen.force_update()beforescreen.get_windows()returns list of windows. Unfortunately docs are lacking this part 🙁