0

We can have multiple screens (as monitors), and in each screen, we can have multiple desktops. I am looking for Mac APIs to loop through all desktops within current NSScreen.

[EDIT]: I can access current screen as: +[NSScreen mainScreen], and loop through all screens via +[NSScreen screens], but these does not talk about desktops within each screens.

Thanks for helping me in advance.

Tulon
  • 4,011
  • 6
  • 36
  • 56
RKS
  • 1,333
  • 2
  • 12
  • 12
  • What is a "desktop" as far as you're concerned? What do you want to know about them or do to them? In OS X, there are Spaces. There are desktop pictures. But there aren't really "desktops" in the sense you seem to be talking about (i.e. things you would query properties of or act on). – Ken Thomases Jan 28 '15 at 06:54
  • I want to get desktop information, so that I can move windows into them programatically. So lets say, i have 2 xcode project windows, that I want to move to Desktop1, all mail windows, I want to move to Desktop and so on. – RKS Jan 28 '15 at 07:08

1 Answers1

0

I assumed your desktops means "Spaces." To my knowledge, there's no API to loop through them all. You could consider adding an observer for NSWorkspaceActiveSpaceDidChangeNotification. I don't really know what your app is going to do. As an example of "Change the wallpaper on all desktops", valexa had an explanation on this condition.

Community
  • 1
  • 1
tsaiid
  • 445
  • 5
  • 14