On 10 May 2016, at 11:10, Etienne Samson wrote:
Depending on what "desktop" means,
there's either -[NSWindow screen]
for getting a window's screen or CGSPrivate to have the Spaces parts
(eg CGSGetWindowWorkspace). IF you don't mind private things ;-).
It would generally be about which “space” the window is on, and I
would need some sort of unique identifier that survives minor
(desktop/spaces) configuration changes and/or reboot.
Which makes me think, that perhaps this is why Apple’s session restore
(that respect spaces) only works when you log out. In this case, they
can be (almost) certain that when the user logs back in, the same spaces
configuration will be recreated. Whereas if you simply quit an
application and relaunch it a month later, it could be a challenge to
figure out what “spaces” the application was actually using.