Overlay window above all windows, even when moving spaces

Hi!

I would like to overlay a macOS application window above all windows, even when moving spaces or moving to a fullscreen app, similar in function to the DropOver app for macOS.

What I have tried:

Overwriting the default app delegate in SwiftUI and creating the NSWindow myself.

Then setting the window.collectionBehavior to [.canJoinAllApplications, .canJoinAllSpaces, .fullScreenAuxiliary] and the window.level to .floating or .statusBar. This works for moving between Spaces, but still does not display above apps in fullscreen mode.

I also registered a notification observer for NSWorkspace.activeSpaceDidChangeNotification, where I call window.orderFrontRegardless() to always have my window frontmost. Still not displaying above fullscreen apps.

What am I missing to make this work?

Best regards

Overlay window above all windows, even when moving spaces
 
 
Q