[compiz] catch event when workspace is changing

David Reveman davidr at novell.com
Tue Nov 14 11:06:05 PST 2006


On Tue, 2006-11-14 at 09:36 +0700, Akbar wrote:
> Hi,
> 
> how do you do that? In normal session, this is how you do it with python:
> import gtk
> import wnck
> 
> def workspace_changed(screen):
>   workspace =  screen.get_active_workspace()
>   print workspace.get_name()
> 
> screen = wnck.screen_get_default()
> screen.connect("active_workspace_changed", workspace_changed)
> 
> gtk.main()
> 
> With compiz, that code does not work because compiz use only one
> workspace (that is very very big). So how do you catch event when
> workspace is changing in compiz session? Python api would be nice, but
> C api is okay.

If the workspace is actually changed, then you'll catch that as normal.
However, that's not what you want to do. You want to know when the
viewport is changed as that's what's happening when you rotate to a
different cube side.

screen.connect("viewports_changed", viewports_changed)

would be it but I even though it's implemented in libwnck, it looks like
it's disabled in the API so you might have to catch the property notify
on your own. There's probably some python bindings for getting property
notify events, _NET_DESKTOP_VIEWPORT is the property you're interested
in.

-David



More information about the compiz mailing list