View Full Version : Application is background only

May 17, 2011, 01:20 AM

If I enable "Application is background only" for an application it works in background then how it differs from Daemon Services (Launch Agents). Because both of them are running in background and starts itself.


May 17, 2011, 02:25 AM
Quote from the Launch Services Keys (https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-109268-BCIGFHGH) chapter of the Information Property List Key Reference.

LSBackgroundOnly (Boolean - Mac OS X) specifies whether this application runs only in the background. If this key exists and is set to “1”, Launch Services runs the application in the background only. You can use this key to create faceless background applications. You should also use this key if your application uses higher-level frameworks that connect to the window server, but are not intended to be visible to users. Background applications must be compiled as Mach-O executables. This option is not available for CFM applications.

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. A click on a window belonging to an agent application brings that application forward to handle events.

The Dock and loginwindow are two applications that run as agent applications.

Setting either of these in your app's Info.plist won't cause your application to automatically start. They're just about what is visible (or potentially visible) to the user once it does start.

So you'd potentially used a combination of both setting up launchd to actually start your program, and setting one of these keys to keep it out of the user's way.