Mailspring/internal_packages/onboarding/lib/main.coffee
Evan Morikawa 55aedef697 feat(startup): new option to launch on system start
Summary:
adds new option to launch on system start

Also adds the `--background` flag to launch N1 in the background (aka not
show the main window).

Test Plan: Manual

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2474
2016-01-28 12:02:08 -08:00

21 lines
767 B
CoffeeScript

PageRouter = require "./page-router"
{SystemStartService, WorkspaceStore, ComponentRegistry} = require 'nylas-exports'
module.exports =
item: null
activate: (@state) ->
# This package does nothing in other windows
return unless NylasEnv.getWindowType() is 'onboarding'
WorkspaceStore.defineSheet 'Main', {root: true},
list: ['Center']
ComponentRegistry.register PageRouter,
location: WorkspaceStore.Location.Center
startService = new SystemStartService()
if (NylasEnv.config.get('nylas.accounts')?.length ? 0) is 0
startService.checkAvailability().then (available) =>
startService.doesLaunchOnSystemStart().then (launchOnStart) =>
startService.configureToLaunchOnSystemStart() unless launchOnStart