I need to make a "full screen overlay window" in a program for OS X. Precisely, the window must at all times be on top of all other windows, including on top of the menu bar in non-maximized-window spaces, and on top of maximized windows in their own spaces, and on top during Exposé. It must not participate in "change space" animations; i.e., its position must be fixed relative to the physical screen at all times. (The window will be semi-transparent and will ignore mouse events, but I know how to do this already.)
How do I achieve this "overlay window" behavior? I have got this far:
window.level
to CGWindowLevelKey(kCGMaximumWindowLevelKey)
so that it is always on top of other windows in the same space.NSWindowCollectionBehaviorStationary
so that the window stays in place during Exposé.What I don't know is how to keep this behavior when switching spaces. I thought I should set NSWindowCollectionBehaviorCanJoinAllSpaces
, but its behavior has two problems:
I have heard that an NSPanel
would help me, but I have not been able to make this work, either.
In short, Can a window appear on top of a fullscreen window in OS X? Can you provide a short, full example?
You should be using window.level = CGWindowLevelForKey(.MaximumWindowLevelKey)
.
I can't help you with the spaces part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With