Search code examples
c++eventsmacosmacos-carbon

Mac OS X: detect already opened app reopen


I have a mac os x app with a window which can be hidden.

When the user clicks on the app icon in the dock (or open -b com.mycompany.myapp in the terminal), I would like this window to be shown again (it's a Qt app, so the setVisible(true) thing is known).

How do I catch the app activation event?

Thanks for any help.


Solution

  • It's an Apple Event, so you'll want to use the Apple Event Manager to register a handler for the core suite's reopen-application event.

    That's how you do it in Carbon. You tagged the question as [carbon] and not [qt], so I assume you want a Carbon solution rather than a Qt solution.