Reputation: 214
I have build a cocoa mac application which is a menubar app. When you click it, it opens a NSWindow.
The problem:
1. When I open the menubar app on Desktop1.
2. Then go to Desktop2 and open the app by clicking the menubar icon, the app opens, but the desktop moves back to Desktop1 !
It's a rather tricky thing.
I appreciate your help ! Thanks
Upvotes: 0
Views: 164
Reputation: 5569
Try setting your window collection behavior to NSWindowCollectionBehaviorCanJoinAllSpaces
so that, well, it isn't restrained to a single desktop.
[newWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
NSWindowCollectionBehaviorMoveToActiveSpace
should also work, but is a little more finicky.
Upvotes: 1