Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSWindow - how to know if a window is hidden vs. minimized?

A NSWindow can be hidden via orderOut: or minimized.

How can I distinguish between the two? isVisible returns 0 in both cases.


1 Answers

If -isMiniaturized isn't working for you, you can manually keep track of the window's miniaturization status by setting up your own status flag that you update when the window is minimized/de-minimized, using either of the following methods:

  • Set up a window delegate that implements windowDidMiniaturize: & windowDidDeminiaturize:

  • Set up an observer for the window notifications, NSWindowDidMiniaturizeNotification & NSWindowDidDeminiaturizeNotification.

like image 92
Josh Freeman Avatar answered Dec 23 '25 00:12

Josh Freeman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!