Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Blakeasd

macrumors 6502a
Original poster
Dec 29, 2009
643
0
Hello World,

I am having problems hiding the key window of other applications. I am able to hide non-key windows with:

Code:
    [[NSWorkspace sharedWorkspace] hideOtherApplications];

My application runs in the status bar as an agent application. The above code would work if my application was not an agent application because my app would be able to steal focus when the user interacts with it and other application windows would become hidden (that is the goal here). I have tried everything to make my agent application work to hide key windows of other applications. I tried showing an invisible NSWindow that is made key and ordered front. The key window of other applications no longer are key, but they won't hide. I'm stuck on what to do next. I also tried forcing my application to be active:

Code:
    [NSApp activateIgnoringOtherApps:YES];

No matter what, the key window of another application won't hide. Is there an alternative way to hide the key window of another application or a different way to hide my app's dock icon besides flagging NSUIElement to 1.

If anyone has any ideas, please share!

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.