9

In my OSX Project I want to:

  • identify the Desktop (one of the expose Spaces) where a NSWindow resides;

  • open a NSWindow in a determined Space, not only on current Space.

Is there a way to do these simple tasks?

Exploring the documentation (NSWindowController, NSWindow, NSScreen) I can't find anything regarding multiple Desktop Management.

Thanks in advance!

1 Answers1

7

You'd think there would be some API for working with Spaces, but there really isn't. You can use CGWindowListCopyWindowInfo to determine which Space a particular window is on, but there's no easy way to open a particular window on a specific space.

There is private API to move windows between spaces, of course. Whether you want to use this in your application depends on your needs - you couldn't use it on a Mac App Store application, obviously.

Found a copy-of-a-copy of the reverse-engineered header I was looking for: https://gist.github.com/rjw57/5495406

Mark Bessey
  • 19,598
  • 4
  • 47
  • 69
  • 2
    Thank you Mark. I contact Apple DTS and they told me: Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations. :( – Andrea Ippolito Feb 25 '16 at 07:11
  • 1
    Yeah, they really need to step up on documenting/supporting CoreGraphicsServices. I will definitely be telling them that at the next WWDC. – Mark Bessey Feb 25 '16 at 16:35