listing windows with python-wnck
So as I said in my previous post I’ve recently found the nice litte libwnck and it’s python bindings.
There are lots of fun things you can do with it, try exploring it with ipython and you’ll see what I mean.
Anyways I wanted to share a little snippet of code with you, this will list all windows and print out their name in the form application name:window name
#!/usr/bin/python2.6
import wnck
screen = wnck.screen_get_default()
screen.force_update() #updates the window list
wins = screen.get_windows()
for win in wins:
app = win.get_application()
win_name = win.get_name() or ''
app_name = app and app.get_name() or ''
print '%s: %s' % (app_name,win_name)
comments Add a comment
Posted 2 years ago