I guess I should check if [NSApplication presentationOptions]
contains NSFullScreenModeApplicationPresentationOptions
, but how do I achieve that?
EDIT: using [NSApplication presentationOptions]
doesn't work as in my document-based app there might be some documents in fullscreen and others not. I'm now looking for another solution. I'm wondering why there isn't a property called [NSWindow isFullscreen]
or something like that.
You need to use an & bitwise operator to test that that option is being used. Not tested but probably something like this:
To see if any of your windows are in full screen mode simply check the style mask of the window.
I was just looking for a solution myself and based on Matthieu's answer I created a category on NSWindow that works fine for me.
For Swift 3.0
Obviously, for the original question, you'd replace
NSApp.mainWindow
with whichever document window you're wanting to check.The way I handled it in pre-10.7 (where neither
NSApplicationPresentationFullScreen
norNSFullScreenWindowMask
was available) was to checkand this piece of really old code seem to still work not only on "Lion" but also on today's - at the time of writing 10.14.x - OS.