jpoz
jpoz

Reputation: 2257

Key Window for background application

I'm creating a backgrounded cocoa application. The only thing that it's missing is the ability to take text inputs!

I'm making the application backgrounded by setting "Application is background only" in the Info.plist

But no matter what I do I can't make any window the keyWindow.

makeKeyWindow
makeKeyAndOrderFront

Both don't work...

I know apps can do this, anyone have any idea how you can get background application to have a key window?

Upvotes: 0

Views: 1007

Answers (1)

diciu
diciu

Reputation: 29333

Try using LSUIElement:

LSUIElement (String - Mac OS X) specifies whether the application runs as an agent application. If this key is set to “1”, Launch Services runs the application as an agent application. Agent applications do not appear in the Dock or in the Force Quit window. Although they typically run as background applications, they can come to the foreground to present a user interface if desired. [..]

If you switch the plist editor to raw keys you will see that "Application is background only" is LSBackgroundOnly which is used for faceless applications.

Upvotes: 5

Related Questions