Is there any way on Mac (including declares or MBS) to have a window or global floating window follow and appear on all spaces/desktops (“spaces” meaning the multiple desktops you can switch through using Mission Control)?
See collectionBehavior in NSWindowMBS in our MBS Xojo Plugins.
And the flags defined there in constants like NSWindowCollectionBehaviorMoveToActiveSpace.
1 Like
Thanks as always, Christian.
1 Like
So combinations of these work well for getting the window to other spaces but I haven’t found a way to display it over a fullscreen window from another app.
self.NSWindowMBS.collectionbehavior = NSWindowMBS.NSWindowCollectionBehaviorFullScreenAuxiliary + NSWindowMBS.NSWindowCollectionBehaviorCanJoinAllSpaces
Probably should work but doesn’t put the window in front of another full screen app.
So I found that the issue is a couple of things.
- The window has to be set as a Global Floating window, this probably is related to NSWindow.windowLevel but I don’t know if you can change level for a regular document window easily
- In the Window open event this code helps
self.NSWindowMBS.collectionbehavior = NSWindowMBS.NSWindowCollectionBehaviorFullScreenAuxiliary + NSWindowMBS.NSWindowCollectionBehaviorCanJoinAllSpaces
- I also had code to hide the titlebar for the window, but apparently that’s what was causing step 2 to not help. Basicaly don’t use the code:
dim newStyle As UInt64 = 0 //no titlebar, not resizeable
if self.Resizeable then newStyle = 8 //no titlebar and resizeable
soft declare sub setStyleMask lib "Cocoa.framework" selector "setStyleMask:" (id As Ptr, mask As UInt64)
setStyleMask(Ptr(self.Handle), newStyle)
After removing that code it seems to be working now, just have to account for the differences in focus caused by floating/global floating windows now.
1 Like
As far as I remember, that just works as well.
1 Like