Merge pull request #6375 from electron/login-item

Add login item API
This commit is contained in:
Cheng Zhao 2016-07-08 10:39:20 +09:00 committed by GitHub
commit 5713e0599b
5 changed files with 131 additions and 0 deletions

View file

@ -598,6 +598,33 @@ Returns the current value displayed in the counter badge.
Returns whether current desktop environment is Unity launcher.
### `app.getLoginItemSettings()` _macOS_
Return an Object with the login item settings of the app.
* `openAtLogin` Boolean - `true` if the app is set to open at login.
* `openAsHidden` Boolean - `true` if the app is set to open as hidden at login.
* `wasOpenedAtLogin` Boolean - `true` if the app was opened at login
automatically.
* `wasOpenedAsHidden` Boolean - `true` if the app was opened as a hidden login
item. This indicates that the app should not open any windows at startup.
* `restoreState` Boolean - `true` if the app was opened as a login item that
should restore the state from the previous session. This indicates that the
app should restore the windows that were open the last time the app was
closed.
### `app.setLoginItemSettings(settings)` _macOS_
* `settings` Object
* `openAtLogin` Boolean - `true` to open the app at login, `false` to remove
the app as a login item. Defaults to `false`.
* `openAsHidden` Boolean - `true` to open the app as hidden. Defaults to
`false`. The user can edit this setting from the System Preferences so
`app.getLoginItemStatus().wasOpenedAsHidden` should be checked when the app
is opened to know the current value.
Set the app's login item settings.
### `app.commandLine.appendSwitch(switch[, value])`
Append a switch (with optional `value`) to Chromium's command line.