Search code examples
c++macosmacos-sierraobjective-c++

How do I find the program with current focus on macos?


Is there API function call that returns an identifier to find out which program has current focus.

I am looking for an answer to this question but in regards to MacOS How do I find the program with the current focus?


Solution

  • Either frontmostApplication or menuBarOwningApplication, depending on what exactly you mean by "focus".