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. Thank you.
> 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. >The event that is the viewport is changing, you should be able to listen for XEvents and then filter the correct one. It is one of my eventual aims to add internal events to compiz for important things such as actions being triggered, special or filtered X events (eg. window minimize, viewport change). I would then like to send these out via dbus as signals so that externals apps can detect them. My earlier patches make the events possible, it is just a case of adding the event triggers in the correct places and then extending the dbus plugin so that it can forward the internal events as dbus signals (possibly with some sort of registration system so unnecessary signals are not sent). This should make it much more straightforward for application developers to integrate with compiz.
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