diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..c96fb719e --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,25 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +# Starting at two years of no activity +daysUntilStale: 730 +# Number of days of inactivity before a stale Issue or Pull Request is closed +daysUntilClose: 30 +# Issues or Pull Requests with these labels will never be considered stale +exemptLabels: + - regression + - security + - triaged +# Label to use when marking as stale +staleLabel: stale +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when removing the stale label. Set to `false` to disable +unmarkComment: false +# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable +closeComment: false +# Limit to only `issues` or `pulls` +only: issues diff --git a/spec/main-process/atom-application.test.js b/spec/main-process/atom-application.test.js index 202c5ed5a..0ae2dc195 100644 --- a/spec/main-process/atom-application.test.js +++ b/spec/main-process/atom-application.test.js @@ -369,7 +369,7 @@ describe('AtomApplication', function () { assert.deepEqual(await getTreeViewRootDirectories(app2Window2), [tempDirPath2]) }) - it('does not reopen any previously opened windows when launched with no path and `core.restorePreviousWindowsOnStart` is false', async function () { + it('does not reopen any previously opened windows when launched with no path and `core.restorePreviousWindowsOnStart` is no', async function () { const atomApplication1 = buildAtomApplication() const app1Window1 = atomApplication1.launch(parseCommandLine([makeTempDir()])) await focusWindow(app1Window1) @@ -379,7 +379,7 @@ describe('AtomApplication', function () { const configPath = path.join(process.env.ATOM_HOME, 'config.cson') const config = season.readFileSync(configPath) if (!config['*'].core) config['*'].core = {} - config['*'].core.restorePreviousWindowsOnStart = false + config['*'].core.restorePreviousWindowsOnStart = 'no' season.writeFileSync(configPath, config) const atomApplication2 = buildAtomApplication() diff --git a/src/config-schema.js b/src/config-schema.js index b19624a38..caacdead8 100644 --- a/src/config-schema.js +++ b/src/config-schema.js @@ -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.', diff --git a/src/main-process/atom-application.coffee b/src/main-process/atom-application.coffee index d21f07c93..b2bfa560b 100644 --- a/src/main-process/atom-application.coffee +++ b/src/main-process/atom-application.coffee @@ -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