ZestyZest
ZestyZest

Reputation: 951

Cocoa: Hiding NSWindow if user is not doing anything

I have a status bar OS X application that has a NSWindow which displays a minimal UI. I want the window to hide automatically (may be using NSTimer) if the user is not interacting with the app.

NSWindow can be hidden using orderOut or setVisible methods but how can I make sure that user is not doing anything critical or interacting with the app Or even the app is not doing some UI updates before it is made hidden?

Do I need to override NSWindow?

Any help would be appreciable.

Upvotes: 1

Views: 127

Answers (1)

qwerty_so
qwerty_so

Reputation: 36295

Implement the windowDidResignKey method of the window delegate. So you know it's no longer key and you can close it.

Upvotes: 1

Related Questions