Atom: Reopen windows when relaunching Atom

Created on 27 Feb 2014  ·  146Comments  ·  Source: atom/atom

A feature I love about ST2 and iA Writer, which I'm missing in Atom, is when you quit the app with open windows (including unsaved documents), they all appear again when you reopen.

This has saved me countless times in my workflow to handle having to do a system restart for software update, etc and not have to take time to save all my unsaved docs, etc.

It's also nice because I generally have five or six open projects that I just keep minimized in the editor for ease of access. It would be great to have such a feature in Atom.

atom enhancement

Most helpful comment

+1,Atom 1.7.3 in my macos 10.11.4 doesn't keep my project

All 146 comments

:+1:

Nice!

I hope to see this working very soon!

It looks like this is mostly ready to go, even. Atom already keeps track of what was last open, and dumps it to JSON in ~/.atom/storage/ The next step is loading these state files at startup.

This feature is also in Brackets, the text editor I used to use.

I was missing that option to!! finally I found package that do just that :) https://atom.io/packages/open-last-project

+1

+1

+1

Isn't there a package which would just support switching between ~/.atom/storage/editor-* sessions? Hell, those JSONs even contain a project field, it should be extremely easy to write one for someone who's already written a package for Atom. I don't understand why the framework doesn't have a GUI and is only accessible via $ atom <path>. Or am I wrong?

Is this issue in a milestone somewhere? +1

+1

+1

As far as I found there is no solution yet when having multiple projects open. Very important aspect IMO: re-opening unsaved documents in the state they were in before the restart, so no work is lost.

+1

@Mil0dV +1, reopening unsaved files (i.e. saving their state into a temp folder) is very important to me, as well.

+1

+1

+1

:+1:

+1

:+1:

+1

Astonishing. This is 2015, not 1995.

I haven't been here for almost 6 months. And yes, it is 2015. Meanwhile, I have been using Brackets.

Not only is this a feature of competing editors, it's actually standard expected behavior on Mac OS as of Lion. Apps should now by default restore their last open windows when the app is quit and relaunched. It feels very strange for Atom to be lacking in this behavior.

Not only is this "a feature of competing editors, and expected behavior on Mac OS as of Lion", it's present in just about every single application since time began. A bit like "Save", and "Quit".

it's present in just about every single application since time began.

I don't think is true for applications that have many instances running at
once. Can you think of an example?

On Mon, Jan 19, 2015 at 11:57 AM, Phil Beauvoir [email protected]
wrote:

Not only is this "a feature of competing editors, and expected behavior on
Mac OS as of Lion", it's present in just about every single application
since time began. A bit like "Save", and "Quit".


Reply to this email directly or view it on GitHub
https://github.com/atom/atom/issues/1603#issuecomment-70551204.

I think SublimeText did this. However, while it is true it is expected behavior, it seems the real stumbling block is the architecture of the program. I use the open-last-project package which will restore tabs and the sidebar (but not multiple windows). It works well enough for a single instance. https://atom.io/packages/open-last-project

@benogle Does this mean this is going in core? (ie. deprecating the community package save-session)

That is the plan. It should be on by default and in core.

@benogle This is amazing news. :dancers: :100:

@benogle Fantastic! :smile: Thanks for the confirmation on this one. It's one of the only things that's stopping me from switching from ST3 full-time.

@benogle Great news, thank you!

+1. Great, and thanks. Like @joshery420 said "..that's stopping me from switching from ST3 full-time....". In many details Atom is better than ST3 (=customizing)

+1,000,000.

I hate having to reopen a folder or project everyday in the morning.

@benogle that is great news.... Atom seems like a nice editor, definitely way more buggier then sublimetext... but the not remebering my last open folder/file structure kills it.

+11111

That's great!!! Expecting it!!

Is this a good first issue? I'm interested in getting involved.

I cant say for certain, but it shouldnt be terribly complex. A lot of it already happens. Say when you start in a directory with atom . and it opens that window with all the previous state. See loadOrCreate for info on that deserialization process.

You should be able to store a list of the open paths on quit, then somewhere in AtomApplication check if the pathsToOpen array is empty. If it is, then load the list of open paths that were saved on quit, and place them in the pathsToOpen array (maybe here).

I am, however, not as well versed in this code as, say, @kevinsawicki. And the storage of those paths might require some thinking.

Okay, thanks for the pointers @benogle! I'll try taking a look at it.

:+1:

+1

+1

Temporary Work Around, run it from the terminal in the folder. It should remember enough stuff for it not to be annoying, and it won't block the terminal.

As an ex sublime user. I also want this feature as well :+1:

I was previously using https://github.com/mpeterson2/save-session

This supports restoring unsaved files (similar to SublimeText)

I just tried out https://github.com/danielmahon/atom-open-last-project

This doesn't appear to support restoring unsaved files - if you quite, Atom will prompt you to save unsaved files.

@benogle @lee-dohm Can I confirm if this plugin is what will make it into Atom 1.0?

If so, this appears contrary to what most users are requesting - which is that Atom remember its state (similar to SublimeText, or most OSX native applications from OSX Lion onwards).

Would be great to get clarification from the Atom team.

Hi I really hope this feature being supported! +1.

+1

+1, lack of this feature is the greatest disadvantage of Atom.

/cc @bolinfest - this relates to that discussion we were having on Friday.

+1

+100 to being able to restore unsaved files. I love Atom, but the fact that this isn't possible is very unexpected behavior, and I've lost work on computer crashes. Even emacs has autosave.

+1 for this too... https://atom.io/packages/save-session looks to do this job perfectly but this should be in core by default.

I just want to reiterate (it can be hard to find it in all the comments now) that this is on the 1.0 roadmap, so it is definitely going to be added, it's just a matter of time (and if someone wants to take a crack at implementing it now).

+1 atom's behavior is not expected now

Once again, this is on the roadmap to 1.0. This means that this feature will be available before Atom 1.0 is officially released. If someone wants to work on this issue, please feel free to create a PR! Otherwise, you can still track the progress on this issue by looking at the labels at the top and seeing whether it's on-deck, in-progress, shipping, etc.

Let me try to summarize what @maxbrunsfeld and @nathansobo and I spoke about:

We agreed that when you open Atom from Spotlight/Dock, then we should just restore everything from the previous session. Currently, Atom remembers nothing when you start it this way because its state is tied to root folders. We decided that the state of a Spotlight/Dock launch should be stored in an application.json file that can have multiple workspace states stored in it.

However, when you launch Atom from the command line, it should have only the root files/folders that you specified on the command line, and the cache key for the workspace should be a function of those root folders.

The analogy is that for Xcode, you basically never launch it from the command line and you expect it to restore the state when you re-launch it from the icon. However, for vi/emacs, you only expect it to open the files you specified on the command line.

This will be in the next Atom version, 0.193.0. :fireworks: :sparkles: :boom:

I'm really excited by this. :stuck_out_tongue_closed_eyes: Congrats guys.

:+1:

+1, very much looking forward to this feature

+1 I need it too

:+1:

Good news :+1:

Does the Desktop shortcut on Windows need updating for this to work, maybe? Because it does not work for me atm, see video: https://youtu.be/SETJog-VnkY

@Stanzilla My understanding is that this feature will be merged in Atom 0.193.0 - which isn't out yet.

@Stanzilla can you make a new issue for this?

From my testing, it doesn't work on Windows (Atom 0.193).

I'm running Atom 0.193.0 on OSX 10.10.3 (Yosemite).

However, I'm not really sure if the functionality is working correctly for me.

I am starting atom via OSX Spotlight.

I previously had the save-session package installed. I disabled this package.

If I have an untitled (i.e. unsaved) document open in Atom, when I quit, it will ask me if I want to save the document.

If I hit "Don't save", when I re-open Atom, that document will not be there.

My understanding was that this issue covered similar functionality to SublimeText, TextMate etc. (or any other modern OSX App) where if you quit, it won't prompt you to save, but will simply re-open to where you left off the next time it starts?

@victorhooi This is just to remember your open windows, period. You'll want to look at #6455

It's work when I press Cmd + Q on my Mac OS, but it does not work when I click on red cross to close the window.

@mehcode Aha, thanks for clarifying - Apparently #6455 has been closed in favour of an earlier issue, #942, so I'll keep my eye on that one.

@ivanlemeshev similarly in Windows it will work when using File > Exit, but not when closing with the close button.

@Xendd Aha, indeed. Thanks for your findings. :+1:

@ivanlemeshev Is that really expected though? On OS X the red button on the window is just for closing that window, the app itself stays running. One could perhaps argue for an option to close the app with the last Window but that is not the conventional behaviour on OS X.

@Xendd Pretty serious for Windows on the other hand, closing the last windows should always work the same as File > Exit

@Leonick, then, maybe, on OS X if you close the last window but the app is still running, reclicking on the app button reopens the last window.
It should work correctly... :)

@ivanlemeshev: It's work when I press Cmd + Q on my Mac OS, but it does not work when I click on red cross to close the window.

I think this is expected behavior on OS X, since as @Leonick said closing the last window does not quit the app, so Atom shouldn't remember your open window if you close it (otherwise Atom would _always_ remember your open windows no matter how many times you close them).

@ivanlemeshev similarly in Windows it will work when using File > Exit, but not when closing with the close button.

That sounds like a Windows bug. Would you mind filing a separate issue for that?

I can confirm that this feature doesn't work on Linux when the window is closed both using shortcut and close button, Atom version 0.194.0.

This feature also doesn't seem to work on Windows (7). Whenever I close the windows in Atom
version 0.194.0 it asks me whether I want to save the changes and when I reopen Atom all tabs are gone.

Actually the pluggin open-last-project for Atom did work better than the "core version". The first one works basically, the core version do not, at all... on my W8.1

Same here, I don't see any options for the core version of this package and it has not saved any session as of so far. (Windows 7)

Windows users, please subscribe to issue #6466

Look forward to a new release, as I can't build atom on linux

For me on Linux (Gnome) it works only if I close it via menu or Ctrl+Q, it does not work if I use the close button in the title bar. Thus it seems to be a general problem.

same here on win 7 sp1 x64

PLEASE SUBSCRIBE TO #6466 IF YOU ARE ON WINDOWS OR LINUX (and don't comment here)
I really don't want to lock this issue again.

If you have a different issue that hasn't already been opened, please create one instead of replying here.

Does not work through Gnome's exit button on Ubuntu 14.04.

+1 for working fix

When there is an update to Atom available and one clicks “Install and relaunch”, Atom loses open windows state.

@iclanzan I believe that will be fixed by #6684.

Restoring windows does not work for me in version 0.201.0 on a Mac with Yosemite 10.10.3. If I have two open windows with different files opened Atom will restore two windows but with the same files (a duplicate of the last active window). The same behaviour happens with three windows.

@joergrech Can you post a list of your installed packages? (apm list --installed)

Here are my installed packages:
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Btw. I reinstalled / updated Atom last week after I had installed it in Spring 2014 (must have been one of the first public versions). If restoring windows should work and nothing else might help I can try to remove everything Atom installed and reinstall it.

@50Wliu it is still not fixed and in fact is even more broken now because it doesn’t even reopen windows under regular circumstances most of the time. If I reopen a project manually, open files are not remembered either.

If I have two open windows with different files opened Atom will restore two windows but with the same files.

@joergrech are you saying that you have the same folder open in two different windows? Saving multiple states for the same folder is not a feature that we've implemented yet. Currently, we save a state per folder.

@iclanzan could you please open a new issue for that and include the following:

  • the version of Atom you're using
  • your OS
  • whether or not it happens in safe mode (atom --safe)
  • and specific reproduction steps

Thanks!

I think he means he had two windows open with two different projects. When
he reopened it, two windows opened, but both had the same project.

I was referring to two things.

First #7156. Someone beat me to it and opened the issue for it.

The second one is opened files are not remembered in a project. I can’t find a way to reproduce this reliably. I did run into #7213 and #7214 while trying though.

Atom 1.0
OSX 10.10.3
Both Atom --safe and with regular atom (for atom --safe I used the command not the dock/spotlight).

Only 1 atom-window open in all the tests.

1.- Start Atom from spotlight or dock (tried both)
2.- add folders or working files.
3.- click on the top left red cross. (but it actually only closes the "working window" not atom itself)
4.- start atom again from spotlight/dock (but it is actually running)

RESULT: empty workspace, as expected.

Different procedure.
1.- Start Atom from spotlight or dock (tried both)
2.- add folders or working files.
3.- cmd+q (it quits the whole application, not only the working window like in the last steps).
4.- start atom again from spotlight/dock (the apps still remains closed so is fresh start).

RESULT: showing the last working files/projects as expected.

Another different procedure.
1.- Start Atom from spotlight or dock (tried both)
2.- add folders or working files.
3.- Atom-menu/quit (it quits the whole application, not only the working window like in the last steps).
4.- start atom again from spotlight/dock (the apps still remains closed so is fresh start).

RESULT: showing the last working files/projects as expected.

RESUME:
Atom does not save the session of your last used window when you close it without exiting the application.

@eljamz That is intended behavior, and is how all OS X applications that save sessions work. Otherwise it would be impossible to remove windows from the saved session - you could only add windows and never remove them without resetting the entire saved session.

@mnquintana Yup, I was just trying to explain the behaviour, that ATOM ISN'T WORKING WRONG, is actually working as expected and it do not save your last windows session because you still have the program running so you can create a new workspace/project but not trying to exit the app because you're done for the day...

So like you said, is not a malfunction is just a miss understanding of the behaviour from some others.

+1
Need this feature...

Now with 1.0 I'm using save-session:
https://atom.io/packages/save-session

+1
Need this feature...

This is already in 1.0 - is it not working for you?

This is already in 1.0 - is it not working for you?

I didn't see any tab after Atom crash.
This is the first day after ST3 and I thought that this function doesn't work =)

Just disable the extension and checked - works fine.

And is there a way to turn this off in 1.0? I don't see any packages to disable.

Hello, I second @schmeisers that this should also be able to be disabled. It is the first thing I turn off when using Notepad++. I use Visual Studio most of the time and Atom as a quick text editor, and it is so frustrating now that it keeps remembering the previous files and projects I had open. What can I do to get this behavior turn-offable? Thanks! I really love Atom!

Any chance of this happening soon?

This has been implemented for more than a few versions now. What Atom version are you currently on?

Oops. Posted that in the wrong issue.

This doesn't count as implemented without #4161. Depending on how Atom decides to close on a given day, it may not restore windows.

@alexchandel Totally agree with you!

@alexchandel @iclanzan The feature was successfully implemented for use under typical circumstances not bound by conditions other than what was already stated.

In my personal experience, files will reopen successfully after a crash, though it seems to have a tendency to use the window data stored on the last successful exit preceding a crash. This would be an issue with how atom handles restores rather than application open/close events. In this sense, it is an issue for #4161 and not for this thread.

This feature is nice, but is there a way NOT to do that ? I mean don't reopen last opened files/folders ? i can't find a way to do it

Actually, I think I've found an issue with this. On OS X, Atom 1.0.4, add a project folder, leave some tabs open, and close Atom; if Atom is reopened by double-clicking a file associated with it, then Atom completely forgets what was last open, and launches with a single window open to the file's folder, with a single tab for the aforementioned file.

+1
I can confirm this issue on Atom 1.0.6 & OS X 10.9.5

If there's behavior related to this feature you'd like to see changed, please comment in an appropriate open issue or open a new issue if one doesn't exist yet - it's too hard to keep track of in an old, already-implemented issue like this. Thanks!

:+1:

Please fix this ... makes Atom so frustrating to develop on. OS X 10.11

Please fix this

This has already been fixed. Please make sure you're running a recent version of Atom (1.2.x should be fine). If you're still experiencing this even on 1.2.x, please file a new bug.

Still experiencing it on 1.2.4. I guess I'll make an issue.

On Fri, Dec 4, 2015 at 12:21 PM Wliu [email protected] wrote:
Please fix this

This has already been fixed. Please make sure you're running a recent version of
Atom (1.2.x should be fine). If you're still experiencing this even on 1.2.x,
please file a new bug.


Reply to this email directly or view it on GitHub .

@50Wliu It is not fixed. It has never been fixed on OS X. Never. I have tested it in every single version since 1.0.4. Pretending it's fixed and asking others to open new bugs helps no one. To replicate:

  1. Open Atom 1.3.2 on OS X 10.11.1.
  2. Add a project folder, leave some tabs open, and close Atom.

    • Repeat Step 2 multiple times for extra fail

  3. Reopen Atom by double-clicking a file associated with it, outside any project.
  4. Atom completely forgets what was last open, and launches with a single window open to double-clicked file's folder, with single tab for the double-clicked file.

Pretending it's fixed and asking others to open new bugs helps no one

There are multiple people on Mac who report this working for them, so I repeat: please make a new issue, and include the information asked for in the debugging guide and CONTRIBUTING.md.

EDIT: I notice you already have - thanks :)

If it is then determined that this functionality has completely regressed, this issue will be re-opened.

Experiencing this on 1.3.2 and OSX 10.11.2

I think I have fixed this by doing

rm -rf ~/.atom/compile-cache

I was experiencing related symptoms on Ubuntu - a session from months ago was recreated on every restart of atom.

rm -rf ~/.atom/compile-cache

seems to have fixed the problem here as well - @snario thanks - first time I saw that suggestion.

Just tested it's already implemented, but I think you need to disable save-session and restart atom, then try again.

Thank you to @snario -- that worked for me on Mac OSX 10.11.3, Atom 1.5.3. I'm using Atom-Project-Manager and it restored my last open project finally.

How did you figure that fix out and why did that fix it? Thanks again.

@snario Thank you! This worked for me as well.

For reference, issue #10044 tracks the "multiple window" bug in the implementation of this issue.

So is this issue fixed? Atom on 1.7.2 still doesn't remember to keep project folders in the sidebar.

+1,Atom 1.7.2 in my macos 10.11.4 doesn't keep my project

CoWinkKeyDinkInc @netfishx Please open new issues and provide all relevant information necessary to help track down your bugs.

+1,Atom 1.7.3 in my macos 10.11.4 doesn't keep my project

@KeinborgMichael Please open a new issue.

dear god why was this not implemented as a plugin and is instead baked right into the core editor? Can't the atom devs adhere by their own philosophies?

+1 Mac v10.11 and Atom 1.8.0 isn't keeping my state between relaunches of Atom

@niij Please open a new issue.

OSX Fix from old thread:

Unbelievable. Finally got it working.

Problem: On a mac, if you close using the red X button in the window, the Atom will still be running. So (now obviously) this is the state it saves, an empty atom.

So, you have to close it using Cmd + Q. Then it will restore correctly the next time.

PS: There should be an option in the settings to close the app completely with the X button.

Referenced in #6605, and hopefully implemented in Atom 1.8.0-beta0 via #11324.

Other temporary fixes include:

  • Clearing the cache
    rm -rf ~/.atom/compile-cache
  • And using the atom-project manager:
    apm install atom-project-manager

@Vvkmnn Thank you! Using CTRL-Q instead of the Red X works for me.

Note that this behavior is the default behavior of apps on OS X. An app can
be running, and it can optionally have windows.

On Mon, Jun 13, 2016 at 4:29 PM Brandon Annin [email protected]
wrote:

@Vvkmnn https://github.com/Vvkmnn Thank you! Using CTRL-Q instead of
the Red X works for me.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/atom/atom/issues/1603#issuecomment-225597537, or mute
the thread
https://github.com/notifications/unsubscribe/AADWlkXiD0pkHjLS00cFDOl_csXasE8Bks5qLWlBgaJpZM4Blkyg
.

Wout.
(typed on mobile, excuse terseness)

I have tried removing complile-cache and installing atom-project-manager. still not restoring my previous project on OS X, even if I close it with cmd-Q

怎么下载

@Leader138 请您用英文,所以别的人可以明白您在说什么呢。谢谢!您要下载什么?


Please use English, so that others can understand what you're saying. Thanks! What are you trying to download?

like @eliotsykes suggested on #10044 , Instead of opening my project folder with a symlink, I used the full path , and now when I exit atom with cmd+Q the project restores succesfully. however, if I just close atom clicking the red close button then It restores empty, so it seems like there are two separate problems, one with symlinks and one with atom saving a blank project on mac

I m using Atom 1.8.0 on Ubuntu16.04LTS x64, and it not reopen the files I opened last time.

@x13945 please open a new issue.

+1 mac not restoring the tree view if you close using the red x

@bb-git Please open a issue for this, if there isn't one already.

Since this was implemented a long, long time ago, I'm going to lock this to keep noise levels down. If you run into issues with Atom not restoring UI state correctly, please see the Contributing guide first, then open a new issue for it if there isn't one already.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

martindale picture martindale  ·  120Comments

alexwhitman picture alexwhitman  ·  119Comments

marlencrabapple picture marlencrabapple  ·  107Comments

renatodex picture renatodex  ·  247Comments

cobyism picture cobyism  ·  101Comments