title: Minimize / miniaturize cocoa NSWindow without titlebar
body: <p>I'm stuck!  Obviously... because I'm posting a question here.</p>
  
  <p>I have built my own custom window controls for my OS X / cocoa app.  The close button works great -- no problems.  The minimize button doesn't work at all when I disable the titlebar.</p>
  
  <p><a href="https://i.stack.imgur.com/up6Qa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/up6Qa.png" alt="enter image description here"></a></p>
  
  <p>So when the title bar is on like the image above and I hit this method, the minimizing works fine:</p>
  
  <p><strong>ViewController.h</strong></p>
  
  <pre><code>@interface ViewController : NSViewController {
  
      - (IBAction)minimize:(id)sender;        
      @property (strong) IBOutlet NSButton *btn_minimize;
  
  }
  @end
  </code></pre>
  
  <p><strong>ViewController.m</strong></p>
  
  <pre><code>@implementation ViewController
  
      - (void)viewDidLoad {
          [super viewDidLoad];
      }
  
      - (IBAction)minimize:(id)sender {
        [[NSApp mainWindow] performMiniaturize:self];
      }
  
      -(IBAction)terminate:(id)sender {
          [NSApp terminate:self];
      }
  @end
  </code></pre>
  
  <p>Then if I disable the title bar, that same method stops working.  No errors, nothing.  I've tried both: <code>[[NSApp mainWindow] miniaturize:nil];</code> and also <code>[[NSApp mainWindow] performMiniaturize:self];</code>.  Neither of which worked.  Actually... the both work IF the title bar is on.  But once I turn it off, neither work.</p>
  
  <p><a href="https://i.stack.imgur.com/mR60B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mR60B.png" alt="titlebar turned off"></a></p>
  
  <p><a href="https://i.stack.imgur.com/DqgmY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DqgmY.png" alt="app with no title bar"></a></p>
  
  <p>Thoughts / comments?</p>
  
  <p>Oh, I'm using Storyboards, Xcode 7, and am targeting 10.10 and using the 10.11 SDK if that matters at all.</p>
  
  <p>Thanks in advance.</p>