Because of a nasty bug in my Macbook pro 2019 with MacOS 10.15.7, it sometimes happens that my Macbook restarts by itself. This is not a big deal usually because almost every app restarts exactly where I left it before the restart but some of them are instead returned to desktop 1 after restart, so that at every restart I have to move them again to the desktop I want them to be. If this can be useful in any way, the apps that behave this way for me are Microsoft Office apps, Visual Studio Code (I work with this so I have several windows open at any time), Spotify, Tidal, Adobe PDF reader. Is there a way to fix this permanently so that every single window of every app reopens exactly at the desktop where it was before restart? For instance, the solution described here Preserve the desktop where an application's window was placed, after a system restart does not fit my needs. Thanks everyone.

  • 1
    That the laptop restarts itself on its own is a serious problem worth looking at a little deeper than figuring out how to have the apps reopen in the correct Desktop. One day, the laptop will restart itself and fail to boot, leaving you with a black screen. Do you do Time Machine or other data backups?
    – IconDaemon
    Apr 9, 2022 at 22:34
  • @IconDaemon you are totally right. Unfortunately I need to change some parameters in my system to work properly with multiple screens and I gave up trying to understand if that’s the only issue causing the restarts, let alone trying to fix that. I am currently almost able to isolate the scenarios in which the laptop restarts so that I can kind of limit the number of times it does that Apr 9, 2022 at 22:38
  • 1
    If you have apps pinned to specific Spaces it should work. If you have apps spanning more than one Space, it won't.
    – Tetsujin
    Apr 10, 2022 at 7:29
  • @Tetsujin do you know if pinning works when using multiple monitors too? Apr 14, 2022 at 1:00
  • 1
    You pin an app to a Space, not specifically a display. If you have two displays & the Mission Control pref 'Displays have separate Spaces' switched off then you can put an app anywhere on either display & it will be remembered as part of that Space.
    – Tetsujin
    Apr 14, 2022 at 7:02

1 Answer 1


I don't believe that it's possible to do what you ask, from within only the apps and the OS.

In particular, it's not my experience that "almost every app restarts exactly where I left it before the restart". I'm having trouble finding more than a very few writing, code editing, or note-taking apps that will reopen multiple windows in multiple desktops. (My goal is to be able to restore at least one app window in each of 21 or more desktops, so the app has to be able to handle that many open windows.)

However, it may be possible to functionally do what you are trying to do, but it's a research project, the problem has not yet been solved, to my knowledge after asking similar questions for years.

Why the OS is Against You

Theoretically, when the OS hibernates in response to a critically low battery or other reasons, it takes a "snapshot" of the current state of the system and then restores that when you reboot. Why can't it do the same whenever you reboot?

When the system hibernates, it presumes that everything else is normal and restoration to the same state is desired. In general, when a reboot happens in the normal course of things, it's because there are reasons to not want everything restored. If you are installing system software or upgrades, if a process has crashed the system, you do not want the system to stay in its current state, you want it to restart. So a hibernation-style snapshot won't do the job, the system will have to record the state in other ways.

But it doesn't. Worse, as noted later, Apple has removed information that would make this process easier. The OS leaves the process of restoring windows pretty much up to the apps themselves.

App Variations in Reboot Robustness

As you have noted, some apps are better than others about this. Typically, it seems to me, apps ported from Windows are not as good at it as native Mac apps. But even apps supplied with the system that you think really have a good reason for behaving like you want, e.g., Stickies, don't do it. When you reboot, previously open Stickies will all open again, but they all appear on Desktop 1.

One would think that of all the built-in Apple apps, Stickies would be the one app where re-opening in the original Desktop Workspace would be integral to the concept of the app. And one would be wrong.

So maybe apps that have been around forever, since before Exposé and Mission Control, don't have what it takes either. But that idea is contradicted by Finder. Finder windows will reopen in the Desktop where they had been.

I have been looking for note-taking and list-making apps that I could use as you describe, where I would have an open app on each Desktop where I would record progress, To-Dos, etc., about the project on that Desktop. So the ability to automatically reopen the app windows on the appropriate Desktop is crucial to that workflow.

Here are some results of testing various apps. Remember, this is about notetaking and to-do-list apps, not apps in general, which is why Finder is not in this list.

Apps that work

  • TextEdit. Built in. Multiple windows. Reboots to original desktops. Preserves unsaved buffers.
  • Notes. Built in. Multiple windows by floating notes. Reboots to original desktops. No unsaved buffers. Can share content with iOS. Master Notes window shows all notes, regardless of where floating notes are positioned, so selecting in this UI will not change Desktops. BEWARE: Float ON TOP has an annoying habit of moving a note window, but not all, along with you when you change Desktops.
  • FoldingText. Free (?). Multiple windows. Reboots to original desktops. FT was recently sold (info from 9/2022); new owner plans a 3.0 release which may be paid.
  • TextDo. Free. Multiple windows. Reboots to original desktops.
  • Typora 1.0. $15. Multiple windows. Markdown. Reboots to original desktops. Preserves unsaved buffers
  • Bear. Free. $1.50/mo to sync with phone. Multiple Windows. Markdown. Reboots to original desktops. Unusual concept of master window that has a paragraph from every file and then files are separately openable from there.

Apps that don’t work

  • Trello. Allows multiple windows in a session. Reboots to only one window in the first desktop.
  • Word. Allows multiple windows in a session. Reboots to only one window in the first desktop.
  • OneNote. Allows multiple windows in a session. Reboots to only one window in the first desktop.
  • MS To Do. No multiple windows. Reboots to the first desktop.
  • BBedit 12. Multiple windows. Reboots to first desktop in the window’s original monitor.
  • Bbedit 14. Same as v12. Even the new Notes mode is not suitable.
  • Text Wrangler — same as BBEdit.
  • TextMate — Allows multiple windows. Reboots with all windows in first desktop.
  • Antnotes — Billed as a better Stickies. Reboots with all windows in first desktop (just like original Stickies).
  • MacVim. Nothing reopens after a reboot and the open files seem to even have vanished from the Recents list, even though they were saved. VIM is a Fail.

I haven't kept notes about apps that are not suitable for lists or note taking, but I have noticed that some apps reopen all windows but puts them all on Desktop 1, some apps only reopen a single window on whatever Desktop you reboot into, and some apps don't reopen at all, even with the "Restore All Windows" setting.

Apps to be tested

I look forward to testing:

  • Code Bubbles
  • Brackets
  • Notion
  • ... and any others that you or others might suggest are good candidates for easy note taking and reboot robustness.

Apple API Info

Meanwhile, I believe that it is possible to do what you ask, but the project is in its infancy.

From OSX 10.5 to OSX 10.8, Apple provided an API window attribute, kCGWindowWorkspace, that would tell you what Mission Control Desktop Workspace any particular window was in; it was simply a fundamental attribute of the window. As it should be, IMHO.

But kCGWindowWorkspace is no longer available. It's been deprecated as of OSX 10.11. That makes it much harder to collect the information you desire.

Scraping by on Minimal Info

For a couple of years now, it's been the accepted wisdom that Apple had removed all Desktop Workspace info from public APIs, but it turns out that's not entirely right. There is an API, NSWorkspaceActiveSpaceDidChangeNotification, which returns true after a change of Desktop Workspace. That's it.

There's a GitHub app, WhichSpace, that puts a numeric icon in the status bar to tell you which Desktop you're in, and you can query that with AppleScript.

And there are various tools, from AppleScript to Keyboard Maestro, that can list all the open windows of the current Desktop and give you info on window size and position.

Prototyping a System

So to do what you ask, it appears to me that you'll need to essentially create a system to to do periodic backups of the current state of all Desktops, perhaps more frequently backing up the current Desktop only.

It's not easy. For example, when you move a window from one Desktop to another, the system can notify you that the Desktop has changed and you can find out the current Desktop/Space number. But it's when you're on the new Destop that you would want to backup the previous desktop and there's no simple way of getting that info without making that the current desktop again.

Then you need a startup routine to unpack the backup info to restore your working environment.

I would love to have such a system. I currently have 21 desktops. When I have to reboot, it feels like it takes me over 20 minutes to get my environment back where I want it, and I have lists and mnemonics and hacks to smooth the process.

That's just my opinion, I could be wrong. I would love to be wrong and to have someone create such a system so simply that anyone could do it.

  • 2
    That's a wonderful answer, thanks for creating this and hopefully a point of reference for people like us struggling with multiple desktops management, I'm actually surprised this isn't managed well enough by the OS. What I feel like suggesting you is to try to pin every app you can to a specific desktop, even though I think you can't really do it if you have several windows pertaining to the same app, and I think that's most of your (our) problem. Sep 6, 2022 at 1:25
  • To do the periodic backup thing (not the notification thing) with AppleScript, it seems one would need to switch to each Space in turn and then try to convince System Events to give you a window id for each window. Various other methods seem to run into dead ends of unreachable/unidentifiable windows. Even a dedicated native app appears to have a sordid history of working across Spaces. Jan 2 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .