I have a simple statusbar applicationn which work in background. I want to know which app currently is active.
It is possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take a look at the
NSRunningApplicationclass and its active property (I’ve linked the documentation for you). You can look at an array of running applications and find the one that’s “active”.Oh, and to get that array of running applications, you can do that via
[NSWorkspace currentWorkspace] runningApplications].Hope this helps!