{"_id":"@adlk/auto-launch","_rev":"1-6573f117d07d41563846bef20b0629bb","name":"@adlk/auto-launch","description":"Launch node applications or executables at login (Mac, Windows, and Linux)","dist-tags":{"latest":"5.0.1"},"versions":{"5.0.1":{"name":"@adlk/auto-launch","version":"5.0.1","description":"Launch node applications or executables at login (Mac, Windows, and Linux)","main":"dist/index.js","scripts":{"test":"gulp test"},"engines":{"node":">=4.0.0"},"repository":{"type":"git","url":"git+https://github.com/4ver/node-auto-launch.git"},"keywords":["login","launch","node-webkit","electron","boot","login-items"],"author":{"name":"Donal Linehan"},"contributors":[{"name":"Adam Lynch","email":"adam@teamwork.com"}],"license":"MIT","bugs":{"url":"https://github.com/4ver/node-auto-launch/issues"},"devDependencies":{"chai":"^3.5.0","coffee-script":"^1.10.0","gulp":"^3.9.1","gulp-coffee":"^2.3.2","gulp-coffeelint":"^0.6.0","gulp-coffeelint-threshold":"^1.0.0","gulp-load-plugins":"^1.2.0","gulp-mocha":"^3.0.1","gulp-util":"^3.0.7","teamwork-coffeelint-rules":"0.0.1"},"homepage":"https://github.com/4ver/node-auto-launch","dependencies":{"applescript":"^1.0.0","mkdirp":"^0.5.1","path-is-absolute":"^1.0.0","untildify":"^3.0.2","winreg":"1.2.2"},"gitHead":"b90a0470467eb84435e6554ae9db1e2c6db79e61","_id":"@adlk/auto-launch@5.0.1","_npmVersion":"5.4.2","_nodeVersion":"8.6.0","_npmUser":{"name":"adlk","email":"stefan@adlk.io"},"dist":{"integrity":"sha512-aE3ONQaWm6/KY1gq20jy7K0feOTNvhQRIYIcQyX1yo5ZwzeVMpcsgGPNAbOXKD88HB8OU4neUuJW2bLTseGGRg==","shasum":"53ea15f668ae4cb4877cf0d732b821289257fca9","tarball":"https://registry.npmjs.org/@adlk/auto-launch/-/auto-launch-5.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGBYmGW7jyg6qMnR17iIv4pqCtJg2FszwryBWdpaZfvgIhAOxb45e+k/GFeJhtXt+9p04rQ5fOrBRCYS8IxCa1Apla"}]},"maintainers":[{"name":"adlk","email":"stefan@adlk.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auto-launch-5.0.1.tgz_1510319120193_0.30804730858653784"}}},"readme":"node-auto-launch\r\n==============\r\n\r\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Windows Build Status][appveyor-image]][appveyor-url] [![Dependency Status][depstat-image]][depstat-url]\r\n\r\n---\r\n\r\nAuto-launch your app on login.\r\n\r\n- :star: Launch any application or executable at startup / login / boot.\r\n- :star: Supports Linux, Mac (via AppleScript or Launch Agent), and Windows.\r\n- :star: Supports [NW.js](http://nwjs.io/) and [Electron](http://electron.atom.io/) (with or without Squirrel; i.e. even if you're using Electron's built-in [`autoUpdater`](http://electron.atom.io/docs/api/auto-updater/) API).\r\n- :star: Auto-detects your app path for NW.js and Electron apps.\r\n- :disappointed: Not Mac App Store friendly. See [Make this Mac App Store compatible](https://github.com/Teamwork/node-auto-launch/issues/43) for more information.\r\n\r\n\r\n## Usage\r\n\r\n```javascript\r\nvar AutoLaunch = require('auto-launch');\r\n\r\nvar minecraftAutoLauncher = new AutoLaunch({\r\n\tname: 'Minecraft',\r\n\tpath: '/Applications/Minecraft.app',\r\n});\r\n\r\nminecraftAutoLauncher.enable();\r\n\r\n//minecraftAutoLauncher.disable();\r\n\r\n\r\nminecraftAutoLauncher.isEnabled()\r\n.then(function(isEnabled){\r\n\tif(isEnabled){\r\n\t    return;\r\n\t}\r\n\tminecraftAutoLauncher.enable();\r\n})\r\n.catch(function(err){\r\n    // handle error\r\n});\r\n```\r\n\r\n## Installation\r\n\r\n`npm install --save auto-launch`\r\n\r\n\r\n## API\r\n\r\n### `new AutoLaunch(options)`\r\n\r\n**`options`** - Object\r\n\r\n**`options.name`** - String\r\n\r\nThe name of your app.\r\n\r\n**`options.path`** - String (optional for NW.js and Electron apps)\r\n\r\nThe absolute path to your app.\r\n\r\nFor NW.js and Electron apps, you don't have to specify the path. We guess based on `process.execPath`.\r\n\r\n**`options.isHidden`** - (Optional) Boolean\r\n\r\nIf `true`, we instruct the operating system to launch your app in hidden mode when launching at login. Defaults to `false`.\r\n\r\n**`options.mac`** (Optional) object\r\n\r\nFor Mac-only options.\r\n\r\n**`options.mac.useLaunchAgent`** (optional) Boolean.\r\n\r\nBy default, we use AppleScript to add a Login Item. If this is `true`, we use a Launch Agent to auto-launch your app. Defaults to `false`. For more information, see [How does it work? (mac)](#mac) below.\r\n\r\n\r\n### `.enable`\r\n\r\nSets your app to auto-launch at startup. Returns a Promise.\r\n\r\n\r\n### `.disable`\r\n\r\nDisables your app from auto-launching at startup. Returns a Promise.\r\n\r\n\r\n### `.isEnabled()`\r\n\r\nReturns a Promise which resolves to a Boolean; `true` if your app is set to launch on startup.\r\n\r\n\r\n## How does it work?\r\n\r\n### Linux\r\n\r\nA [Desktop Entry](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) is created; i.e. a `.desktop` file is created in `~/.config/autostart/`.\r\n\r\nNote: if auto-launch is enabled and then your app is removed, this desktop entry file would be left behind on the user's machine.\r\n\r\n\r\n### Mac\r\n\r\n#### AppleScript (default)\r\n\r\nWe execute an AppleScript command to instruct `System Events` to add or remove a Login Item for your app. There are no files involved. To see your Login Items, you can go to *System Preferences*, *Users & Groups*, then *Login Items*. End users can add or disable items (including your app) here also, but most typical users aren't aware of it.\r\n\r\n![Login Items screenshot](images/loginItemsScreenshot.png)\r\n\r\nNote: This is not Mac App Store friendly; if you use it in your app, it will be rejected by the Mac App Store. We're only 99% sure on this as we haven't actually tried ourselves. See [Make this Mac App Store compatible](https://github.com/Teamwork/node-auto-launch/issues/43) for more information.\r\n\r\n\r\n#### Launch Agent\r\n\r\nThis is a file-based method like Linux's Desktop Entry method. We add a `.plist` file in the user's `Library/LaunchAgents` directory to create a [Launch Agent](https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html) for your app.\r\n\r\n**Pros**\r\n\r\n- Launch Agents are intended for daemons / something without UI, which might be applicable depending on your app.\r\n- We *think* this method *seems* to be faster, as in to enable or disable auto-launching (there is no difference in the amount of time it takes your app to launch). Although, that's not really a concern.\r\n- You might not trust AppleScript.\r\n\r\n**Cons**\r\n\r\n- Your app will not appear in the user's Login Items. Therefore the user can only toggle auto-launching inside your app, if you provide them with a setting of course (which you should!). This is not a huge deal as most users are not aware of Login Items preferences, but it would be ideal if your app appeared there.\r\n- If the user was to remove your app, the file would be left behind on the user's machine.\r\n\r\nIf you find that the AppleScript method doesn't work for you and this method does, please let us know by [creating an issue](https://github.com/Teamwork/node-auto-launch/issues/new).\r\n\r\nNote: This is not Mac App Store friendly; if you use it in your app, it will be rejected by the Mac App Store as this reaches outside of the app sandbox. See [Make this Mac App Store compatible](https://github.com/Teamwork/node-auto-launch/issues/43) for more information.\r\n\r\n\r\n### Windows\r\n\r\nWe add a registry entry under `\\Software\\Microsoft\\Windows\\CurrentVersion\\Run`.\r\n\r\nNote: If the user was to remove your app, this would be left in the registry, but that's not such a big deal. You can probably configure your uninstaller to unset it.\r\n\r\n\r\n#### Squirrel.Windows\r\n\r\nIf you're using [Squirrel.Windows](https://github.com/Squirrel/Squirrel.Windows), i.e. what's underneath Electron's built-in [`autoUpdater`](http://electron.atom.io/docs/api/auto-updater/) API on Windows, we add a registry entry for your app's `Update.exe` instead of your actual application. This is due to how Squirrel.Windows works under the hood. What if we didn't? Well, if the user started / restarted their machine after updating your app, it would launch the old version by mistake.\r\n\r\n\r\n# Would you like to contribute?\r\n\r\nWe're always open to your help and feedback. See our [CONTRIBUTING.md](CONTRIBUTING.md).\r\n\r\n\r\n[npm-url]: https://npmjs.org/package/auto-launch\r\n[npm-image]: http://img.shields.io/npm/v/auto-launch.svg?style=flat\r\n\r\n[appveyor-url]: https://ci.appveyor.com/project/adam-lynch/node-auto-launch/branch/master\r\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/0sraxp65vrj2axc3/branch/master?svg=true\r\n\r\n[travis-url]: http://travis-ci.org/Teamwork/node-auto-launch\r\n[travis-image]: http://img.shields.io/travis/Teamwork/node-auto-launch.svg?style=flat\r\n\r\n[depstat-url]: https://david-dm.org/teamwork/node-auto-launch\r\n[depstat-image]: https://david-dm.org/teamwork/node-auto-launch.svg?style=flat","maintainers":[{"name":"adlk","email":"stefan@adlk.io"}],"time":{"modified":"2022-04-04T11:31:26.726Z","created":"2017-11-10T13:05:21.490Z","5.0.1":"2017-11-10T13:05:21.490Z"},"homepage":"https://github.com/4ver/node-auto-launch","keywords":["login","launch","node-webkit","electron","boot","login-items"],"repository":{"type":"git","url":"git+https://github.com/4ver/node-auto-launch.git"},"contributors":[{"name":"Adam Lynch","email":"adam@teamwork.com"}],"author":{"name":"Donal Linehan"},"bugs":{"url":"https://github.com/4ver/node-auto-launch/issues"},"license":"MIT","readmeFilename":"README.md"}