Has there been any advancement in discovering and/or setting which desktop/workspace my application is on (under Linux/Solaris of course)?
2 Answers
Discovering/setting the desktop on modern window managers is done through reading/setting the _NET_WM_DESKTOP
property from the EWMH specification ( http://packages.debian.org/search?keywords=proftpd-basic&searchon=names&suite=all§ion=all )
I'm not aware of any neatly encapsulated API's that expose this functionality, but google turned up http://code.google.com/p/ewm/source/browse/trinity/fusion-X11/trunk/src/main/java/org/fusion/x11/ewmh/NetFrameExtents.java which might be a start.

- 6,709
- 1
- 25
- 36
-
I have found a way thorugh KD3 KWin using the window id but am finding it equally difficult to discover the window id. How does one get the _NET_VM_DESKTOP property? – brad12s Sep 03 '11 at 23:53
-
I ended up going through JIN to get the window id from Xlib then into KWIN to manipulate the desktop settings for the Frame. – brad12s Sep 05 '11 at 03:02
I'm the author of the project proviously linked by the "NetFrmeExtents.java"
Here's my answer:
It's hard to do in pure java if not impossible unless swing/awt has implemented it by now. The most straightforward (and only?) way is to use JNI and do it through xlib/xcb. But it is possible to do what you ask.
There is a desktop convention called EWMH that can help you with what you want. The basic order of steps you need to is:
- Get the window id of your application. To do this Google how to retrieve the window handle/window id in awt.
- Next you need to read several "properties" defined by atoms. If you don't know what this is google how to read a property from a window in xlib/xcb.
- In the EWMH there is a property that lists all virtual desktops defined by the window manager. See http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2449367
- Set the property a property on your application's window, see http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507080 to the number of the virtual desktop you want your application to be on.
If you have done everything correct and the window manager supports ewmh (most do) it should work.

- 782
- 7
- 18