12

I'm looking for either a setting option of NSWindow in XIB editor or via programmatically take I can disable the fullscreen mode feature in OS X when the user clicks the zoom button (green traffic light), as it does not work well with my UI design. (Instead, use it for normal window zooming.)

Anyone can give me some hints where to look for?

Cai
  • 3,609
  • 2
  • 19
  • 39
  • 3
    I don't see anything stupid here. It's just a simple question that if we can achieve such purpose. In some cases it's not a good idea to have things go fullscreen. – Cai Oct 31 '15 at 22:16
  • 1
    No. 1, if you are going to submit your app to Mac App Store, it will be rejected. If it's not rejected, that will only be because they don't find the function that is not working. No. 2, if there is a visible interface control, naturally, the user is going to click on it or whatever. If it's not functional, then don't show it in the first place. – El Tomato Oct 31 '15 at 22:48
  • 1
    @ElTomato "No. 1, if you are going to submit your app to Mac App Store," can you show where have you read that? – Leo Dabus Oct 31 '15 at 23:10
  • 2
    @LeoDabus: I just added an answer that might be of help to you: http://stackoverflow.com/a/33457584/499581. I seriously doubt Apple will reject your app, seeing as how they explain how to override it in the documentation :) – l'L'l Oct 31 '15 at 23:11
  • I'm also curious why they'd wanted to ban an app that does not need fullscreen mode. Zooming is fine, but fullscreen mode make things unusable in my situation. I'd wanted to know the answer anyways, MAS or not. – Cai Oct 31 '15 at 23:15
  • I agree with you on that completely; and would be interested to see where that is stated in the guidelines. Apparently all menubar apps should be rejected accordingly :p – l'L'l Oct 31 '15 at 23:19
  • I've no idea why it's considered duplicate. Anyways, I added the answer I figured out to my question. – Cai Oct 31 '15 at 23:24
  • 1
    Well I think the title and the part about the zoom button was what made it appear to be a duplicate. It wasn't exactly clear how you wanted to disable full-screen mode (either by a button or disabling the hot-keys, etc.) – l'L'l Oct 31 '15 at 23:25

2 Answers2

16

Here's what I figured out.

To change the behavior of the zoom button to normal window zooming (not by hiding the button), change the window to "Auxiliary" will do.

XIB Editor

Attributes Inspector > Full Screen > Auxiliary Window

If there's a better answer to this, I'd be more than happy to accept that as the correct answer.

pkamb
  • 33,281
  • 23
  • 160
  • 191
Cai
  • 3,609
  • 2
  • 19
  • 39
  • 1
    To do this programmatically: `[[self window] setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];` – AndyTang Mar 02 '20 at 15:49
1

For SwiftUI:

.onReceive(
    NotificationCenter.default.publisher(
        for: NSApplication.willUpdateNotification), perform: { _ in
            for window in NSApplication.shared.windows {
                window.collectionBehavior = .fullScreenAuxiliary
            }
})
fankibiber
  • 729
  • 1
  • 6
  • 19