Something that’s always been a bit of a hack in Mac OS X Leopard is settings your application to launch at login per a user preference. Prior to Leopard it involved open the user’s loginwindow.plist file and manually adding/removing it from there or using Apple’s System Events sample.
Luckily with Leopard, Apple has offered a better way of doing this.
The Shared File List API is new to Launch Services in Mac OS X Leopard. This API provides access to several kinds of system-global and per-user persistent lists of file system objects, such as recent documents and applications, favorites, and login items. For details, see the new interface file LSSharedFileList.h. - Launch Services Release Notes
If you take a peak in the LSSharedFileList.h file, you’ll see all you need to get started. I couldn’t find any sample code on how to use this new functionality, so in an attempt to appease the Google gods and hopefully contribute something useful back to the community, I put together a sample project that adds an application to the currently logged in account’s Login Items listing.
The code looks for the application in the user’s /Applications directory and then adds or removes it based on the user’s preference.
You can grab the sample project over at Github.
Github: Shared File List Example
If you have any feedback, please send me an email.

