How I can disable the big screen on an OS X app?

Hi, I'm making an app for OS X, but I have a problem, I would like to disable the big screen mode (the green button) on my app, like in the Preferences app, if you see that app, the green button are disable, I would like to do the same, how I can do it?

If you simply want to disable the green button (like in the System Preferences app), the following should work in Swift:


var button = view.window?.standardWindowButton(NSWindowButton.ZoomButton)

button?.enabled = false

If you just want to disable a window from going into full-screen mode, you can set the window's behavior to disallow that. You can set it in Interface Builder by selecting the window, selecting the Attributes inspector, and changing the Full Screen pop-up menu to Unsupported. In code, you would set the window's collectionBehavior property to not include NSWindowCollectionBehaviorFullScreenPrimary.


When a window does not support full-screen, the green button does the traditional zoom behavior. That resizes the window between its "ideal" size and the last size the user set it to, but doesn't go full-screen. The ideal size is likely to mostly fill the screen, but the window will still have its title bar and still be on a Space with other windows. If you don't want to allow the window to resize at all, you can configure that. In IB, you would uncheck the Resize checkbox on the Attributes inspector. In code, you would set the window's styleMask to not include NSResizableWindowMask.


I would only recommend Max108's approach if you want the window to be resizable but not zoomable, although that's kind of a strange thing to want.

How I can disable the big screen on an OS X app?
 
 
Q