Git Product home page Git Product logo

Comments (7)

adam-lynch avatar adam-lynch commented on July 19, 2024 5

As of 5.0.0, we have two methods for auto-launching on Mac;

  1. Using AppleScript to tell System Events to add a Login Item for the app.
  2. Adding a file-based Launch Agent; i.e. adding a .plist to the user's Library/LaunchAgents directory.

Neither of these will be accepted in the MAS. I'm 99% sure about number 1, just because I haven't tried to get it into the app store.

Number 2 reaches outside the app sandbox.

App sandbox diagram

App sandbox allowed directories


It seems like a tricky problem even if you were writing a completely native app. So is it possible at all to have an auto-launching app in the app store? Yes, according to Modern Login Items. Your app would need to not be auto-launching by default, there would have to be a setting for the user to toggle it on or off, and you need a Launch Agent. The Launch Agent needs to be a separate app/executable with special permissions (and needs to be signed like your main app).

Since it needs custom native code and it needs to be signed, that's not something that will be added to this module.

It makes more sense to either create this manually yourself, or if it was added to nw-builder, electron-builder (see electron-userland/electron-builder#756), etc.

Even if you have this extra (signed) app, that might not be enough as Modern Login Items tells us it needs to contain a "user preference". I don't think there is any way you could toggle this user preference aside from programmatically with native code. This leads me to think that NW.js and Electron would need to expose an API for this with native code underneath which toggles the preference.

Or (which just popped into my head...) maybe it's possible to toggle it with a custom native module. I'm not sure.


I created this module for future reference and assume we won't make much progress on it, but if you have an idea or can help, feel free to reply below.

from node-auto-launch.

adam-lynch avatar adam-lynch commented on July 19, 2024 2

@transitorykris we'd love to support this but I'm not sure how. The above comment and links sum up everything we know on the subject. We're open to suggestions.

from node-auto-launch.

transitorykris avatar transitorykris commented on July 19, 2024

This was marked closed and marked as invalid. Is this not a concern for the project, or is there a work around elsewhere (I'm guessing no since the readme says explicitly the app is likely to be rejected).

from node-auto-launch.

GorvGoyl avatar GorvGoyl commented on July 19, 2024

seems like electron has find a way to MAS friendly auto-start option for MAC. see here https://electron.atom.io/docs/api/app/#appsetloginitemsettingssettings-macos-windows

from node-auto-launch.

adam-lynch avatar adam-lynch commented on July 19, 2024

@JerryGoyal

Note: This API has no effect on MAS builds.

I interpret that as: this API does nothing when used in MAS builds.

from node-auto-launch.

beaur avatar beaur commented on July 19, 2024

This appears to be possible in the latest 2.x betas?
https://github.com/electron/electron/blob/v2.0.0-beta.2/docs/api/app.md#appsetloginitemsettingssettings-macos-windows

from node-auto-launch.

beaur avatar beaur commented on July 19, 2024

Changes appear to have been added here electron/electron@8184cbf#diff-c0db39733aba3af6dedd3c8a42082f92

from node-auto-launch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.