mirror of
https://github.com/atom/atom.git
synced 2026-02-07 05:05:02 -05:00
Merge remote-tracking branch 'origin/master' into zhu-li-do-the-thing
This commit is contained in:
@@ -248,9 +248,10 @@ const configSchema = {
|
||||
default: true
|
||||
},
|
||||
restorePreviousWindowsOnStart: {
|
||||
description: 'When checked restores the last state of all Atom windows when started from the icon or `atom` by itself from the command line; otherwise a blank environment is loaded.',
|
||||
type: 'boolean',
|
||||
default: true
|
||||
type: 'string',
|
||||
enum: ['no', 'yes', 'always'],
|
||||
default: 'yes',
|
||||
description: "When selected 'no', a blank environment is loaded. When selected 'yes' and Atom is started from the icon or `atom` by itself from the command line, restores the last state of all Atom windows; otherwise a blank environment is loaded. When selected 'always', restores the last state of all Atom windows always, no matter how Atom is started."
|
||||
},
|
||||
reopenProjectMenuCount: {
|
||||
description: 'How many recent projects to show in the Reopen Project menu.',
|
||||
|
||||
@@ -121,6 +121,8 @@ class AtomApplication
|
||||
|
||||
launch: (options) ->
|
||||
if options.pathsToOpen?.length > 0 or options.urlsToOpen?.length > 0 or options.test or options.benchmark or options.benchmarkTest
|
||||
if @config.get('core.restorePreviousWindowsOnStart') is 'always'
|
||||
@loadState(_.deepClone(options))
|
||||
@openWithOptions(options)
|
||||
else
|
||||
@loadState(options) or @openPath(options)
|
||||
@@ -575,6 +577,7 @@ class AtomApplication
|
||||
windowDimensions ?= @getDimensionsForNewWindow()
|
||||
openedWindow = new AtomWindow(this, @fileRecoveryService, {initialPaths, locationsToOpen, windowInitializationScript, resourcePath, devMode, safeMode, windowDimensions, profileStartup, clearWindowState, env})
|
||||
openedWindow.focus()
|
||||
@lastFocusedWindow = openedWindow
|
||||
|
||||
if pidToKillWhenClosed?
|
||||
@pidsToOpenWindows[pidToKillWhenClosed] = openedWindow
|
||||
@@ -616,8 +619,7 @@ class AtomApplication
|
||||
@emit('application:did-save-state')
|
||||
|
||||
loadState: (options) ->
|
||||
restorePreviousState = @config.get('core.restorePreviousWindowsOnStart') ? true
|
||||
if restorePreviousState and (states = @storageFolder.load('application.json'))?.length > 0
|
||||
if (@config.get('core.restorePreviousWindowsOnStart') in ['yes', 'always']) and (states = @storageFolder.load('application.json'))?.length > 0
|
||||
for state in states
|
||||
@openWithOptions(Object.assign(options, {
|
||||
initialPaths: state.initialPaths
|
||||
|
||||
Reference in New Issue
Block a user