Il giorno sab, 06/03/2010 alle 20.16 +0100, Osmo Maatta ha scritto:
> 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.


http://lists.gulp.linux.it/pipermail/gulp/2009-September/035843.html

That's in Italian, but I guess the code logic is quite understandable...
and works (you can verify by adding a print).

If I recall correctly, I too at the time had problems that had to do
with the gtk main loop not running.

cheers

Pietro

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to