[pygtk] Wnck: Switching to and reporting current workspace (desktop) number.

Osmo Maatta osmoma at gmail.com
Sun Mar 7 03:16:02 WST 2010


Hello,
This question is about the Wnck library. I still hope someone here can 
shed light on this issue.

The following code snippet loops though all active workspaces/desktops.
It then tries to report the actual desktop/workspace number, but the 
"current workspace num" does not change.

The code is here: http://www.futuredesktop.com/tmp/desktop_test.py

Look at the last three lines.
       ws  = screen.get_active_workspace()
       ws_num = ws.get_number()
       print "i=", i, "   current workspace num=", ws_num

I reports something like this:
   i= 0    current workspace num= 1
   i= 1    current workspace num= 0
   i= 2    current workspace num= 0
   i= 3    current workspace num= 0
   i= 4    current workspace num= 0

The "current workspace num" is totally wrong.
Why does Wnck behave like this?

BTW: I run this code on 64bit Ubuntu 9.10 with GNOME + Metacity Window 
Manager (not Compiz WM).
$ metacity --replace

References: http://library.gnome.org/devel/libwnck/stable/
http://library.gnome.org/devel/libwnck/stable/WnckScreen.html#wnck-screen-get-active-workspace

I may start to use the "wmctrl" command directly.
It rocks but I would rather not be dependent on external tools, 
subprocess'ing that from my Python modules.

Cheers,
   Osmo (Moma) Antero
   Grønland







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100306/d4f6e35e/attachment.htm 


More information about the pygtk mailing list