views:

58

answers:

2

I'm trying to figure out how to detect when the current user has changed their workspace in Mono. I'm not even really sure how the workspace aspect of Gnome operates. A brief look through Monodoc didn't turn anything up, and I couldn't locate a GConf key that gave me what I wanted either.

Update: The method below will ONLY work if Compiz is not set to have a virtual size. For instance, if you set the number of desktops in Compiz to 1 with a horizontal virtual size of 2, Gdk.Global.CurrentDesktop will return 0 for both workspaces.

So does anyone know of a method for finding if the workspace has been changed when Compiz has virtual desktops enabled?

+1  A: 

This is actually a feature of the window manager, and how exactly it works varies between window managers. I'm not familiar with how to access xlib in Mono, but you're looking for the _NET_NUMBER_OF_DESKTOPS, _NET_DESKTOP_NAMES, _NET_CURRENT_DESKTOP, etc. X properties on the root window.

FreeDesktop.org's Extended Window Manager Hints specification contains many of the details.

derobert
Armed with that I did a little more digging and discovered the Global class in GDK holds the properties equivalent to those you gave. Thanks!http://www.go-mono.com/docs/index.aspx?tlink=24@ecma%3a261%23Global%2fP
marco0009
A: 

Use libwnck. I am pretty sure there is a Mono wrapper for it.