Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Reopen windows when starting app w/ no arguments - #6380

Merged
maxbrunsfeld merged 7 commits into
masterfrom
mb-reopen-windows
Apr 15, 2015
Merged

maxbrunsfeld merged 7 commits into
masterfrom
mb-reopen-windows

Conversation

@maxbrunsfeld

Copy link
Copy Markdown
Contributor
  • Write integration test
  • Make it pass
  • Fix duplicated logic for working w/ ~/.atom/storage
  • Debug integration test failures

Closes #1603.

Comment thread src/browser/atom-application.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use stateString here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks. I think I'm going to 🔥 this and extract a couple of helper functions for working with the storage directory here and in atom.coffee.

@maxbrunsfeld
maxbrunsfeld force-pushed the mb-reopen-windows branch 2 times, most recently from 04eb4d5 to d89d5b7 Compare April 15, 2015 22:06
@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Ok, specs are good; the TextEditorComponent spec fixes just aren't on this branch.

maxbrunsfeld pushed a commit that referenced this pull request Apr 15, 2015
Reopen windows when starting app w/ no arguments
@maxbrunsfeld
maxbrunsfeld merged commit c665747 into master Apr 15, 2015
@maxbrunsfeld
maxbrunsfeld deleted the mb-reopen-windows branch April 15, 2015 22:50
Comment thread src/storage-folder.coffee

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the utf8 here, JSON.parse handles Buffer objects.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be deleted after it is read? So if Atom is crashing because of the window state it doesn't keep retrying on subsequent launches.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but I think we should make that it's own issue, just because it'd be a little bit of a behavior change from what we have now, and I think it'd take a little testing to make sure we didn't ever unintentionally wipe out the user's state.

@benogle

benogle commented Apr 15, 2015

Copy link
Copy Markdown
Contributor

SHIIIIIT. This will make soo many people happy

@basarat

basarat commented Apr 15, 2015

Copy link
Copy Markdown
Contributor

image

@benogle

benogle commented Apr 15, 2015

Copy link
Copy Markdown
Contributor

One piece of feedback: it doesnt keep the active window. So on restart the focused window may not be the window focused on quit. Other than that, it's great 🎉

Comment thread src/storage-folder.coffee

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Atom fails to start if this error is thrown, should it just resort to the default window in this case instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks for catching that. Fixing that up on master.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

So on restart the focused window may not be the window focused on quit.

Yeah, we should do this. I opened a separate issue for it since it's not totally trivial to do.

@nathansobo

Copy link
Copy Markdown
Contributor

❤️ You're amazing @maxbrunsfeld.

@jacekkopecky

Copy link
Copy Markdown
Contributor

This PR doesn't do autosave, does it? Is there another issue beside #1603, or another PR, on that?
There are two aspects to auto-save:

  • the open windows and buffers - so that re-opening works also on crash
  • the changes in unsaved buffers (including unnamed ones) - so that work doesn't get lost on crash

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

@jacekkopecky does the built-in autosave package do what you want? It saves all buffers whenever the application loses focus.

@benogle

benogle commented Apr 21, 2015

Copy link
Copy Markdown
Contributor

@maxbrunsfeld I think @jacekkopecky might mean to autosave of the application state, rather than the buffers themselves.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Oh, yeah. Currently, the application state is only saved on quit.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Regarding the application crash use case: I think autosaving the contents of open buffers is critical because it prevents work from being lost. I don't think autosaving the opened windows falls into that category though; I'd rather address that problem by reducing the frequency of crashes.

@jacekkopecky That said, if Atom is crashing on you often enough that reopening your opened windows would be a major improvement, then maybe we should implement that feature. Feel free to open a new issue for this.

@mehcode

mehcode commented Apr 21, 2015

Copy link
Copy Markdown
Contributor

@maxbrunsfeld I think it's critical. It's not about atom crashing or not crashing. It's about a myriad of other things crashing on a computer. It's about being able to not kill a junior because he or she accidentally hit the reset button on your computer. Sublime gives you the "don't worry about it" guarantee. It's a state of mind and affects your workflow. I was used to having many unnamed buffers open with random scratch data. I didn't need to save it anywhere but sublime kept them around.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Ok @mehcode could you open an issue for that feature?

It's about being able to not kill a junior because he or she accidentally hit the reset button on your computer.

I think this use case is covered though, because Atom should quit normally during a system restart (at least on OSX and Linux).

@mehcode mehcode mentioned this pull request Apr 21, 2015
@denieler

Copy link
Copy Markdown

We are moving forward with this idea with save-workspace plugin. It give opportunity to save whole workspace (tabs, splitting, project folders opened, etc.) and move between them very fast.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reopen windows when relaunching Atom

8 participants