MacGapProject / MacGap1

Desktop WebKit wrapper for HTML/CSS/JS applications.
Other
3.55k stars 208 forks source link

Login Items / Open at Login #129

Open marcolz opened 10 years ago

marcolz commented 10 years ago

Hello - Is there a way to configure MacGap apps to open (automatically) at login?

rawcreative commented 10 years ago

Yes, there are two ways to do it, depending on whether your app is sandboxed (app store) or not, but both require adding some Obj-c code to your project.

If you're planning on submitting to the app store, or your app is otherwise sandboxed, you have to create a separate 'helper' app and include that in your project. The helper app simply needs to open your main app and then quit, and the app needs to be bundled inside the main app. Here's an article that goes into detail and provides some sample code: http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/

If your app is not going to be sandboxed or be on the app store, than you can use Launch services and the LSSharedFileList. Here's a SO post that has a few code snippets/approaches you could use:http://stackoverflow.com/questions/815063/how-do-you-make-your-app-open-at-login

Unfortunately this is not something that can be added to MacGap simply because the latter method will prevent app store acceptance and the first method requires specific knowledge of the project and secondary app creation.