![]() You can then register your helper app via the terminal with the commands: launchctl bootstrap gui/$UID Īnd launchctl bootout gui/$UID I couldn't get it to work the easy way using SMLoginItem, and ended up resorting to the extremely tedious method of calling the command line tool launchctl via NSTask to tell launchd to treat my helper app as a startup item.īasically, you'll need to create and maintain a in an appropriate library folder ( appropriate folders) which contains the path to the executable of your helper app and some other configurations most importantly KeepAlive which will tell launchd to automatically reopen your app should it ever crash or be closed by the user, and RunAtLoad which will lead to your app to be started at login. Is there a workaround for this? Could you maybe extend the functionality of the SMLoginItemSetEnabled function or something like that? Or should I use a completely different approach?Įdit Is there a tag for login items? I feel like my tags are really bad. I can't write helper.app into System Preferences.app's Bundle of course. I think the problem is that this function only works if helper.app is located in the main application bundle’s “Contents/Library/LoginItems” directory, but the "main application" which calls this function seems to be System Preferences.app, and not my.prefpane, which contains helper.app. "Could not locate login item in the caller's bundle" ![]() I tried using SMLoginItemSetEnabled cause it seems to be the most elegant solution - but I can't get it to work. I have both apps in the same project and I managed to add helper.app to my.prefpane's App Bundle, but I can't figure out how to enable helper.app as a login item. I'm trying to make a Preference Pane which registers a helper app as a login item.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |