diff --git a/spec/integration/fixtures/atom-home/config-openEmptyEditorOnStart.cson b/spec/integration/fixtures/atom-home/config-openEmptyEditorOnStart.cson new file mode 100644 index 000000000..84ea0be11 --- /dev/null +++ b/spec/integration/fixtures/atom-home/config-openEmptyEditorOnStart.cson @@ -0,0 +1,7 @@ +"*": + welcome: + showOnStartup: false + "exception-reporting": + userId: "7c0a3c52-795c-5e20-5323-64efcf91f212" + core: + openEmptyEditorOnStart: false diff --git a/spec/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index d2583ed27..67f4dc0a8 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -196,6 +196,13 @@ describe "Starting Atom", -> , 5000) .waitForExist("atom-workspace") .waitForPaneItemCount(1, 5000) + + it "doesn't open a new window if openEmptyEditorOnStart is disabled", -> + fs.writeFileSync(path.join(atomHome, 'config.cson'), fs.readFileSync(path.join(__dirname, 'fixtures', 'atom-home', 'config-openEmptyEditorOnStart.cson'))) + runAtom [], {ATOM_HOME: atomHome}, (client) -> + client + .waitForExist("atom-workspace") + .waitForPaneItemCount(0, 5000) it "reopens any previously opened windows", -> runAtom [tempDirPath], {ATOM_HOME: atomHome}, (client) -> diff --git a/src/atom.coffee b/src/atom.coffee index 28058f8dd..05228b6ca 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -669,6 +669,7 @@ class Atom extends Model @windowEventHandler?.unsubscribe() openInitialEmptyEditorIfNecessary: -> + return unless @config.get('core.openEmptyEditorOnStart') if @getLoadSettings().initialPaths?.length is 0 and @workspace.getPaneItems().length is 0 @workspace.open(null) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index a1bd91cc7..d8eeb6fe3 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -89,6 +89,10 @@ module.exports = 'windows1258', 'windows866' ] + openEmptyEditorOnStart: + description: 'Automatically opens an empty editor when atom starts.' + type: 'boolean' + default: true editor: type: 'object'