Tell HN: How to make macOS restore windows to their respective desktops

  • Posted 2 weeks ago by peterjmag
  • 1 points
Originally posted as a comment in this thread: https://news.ycombinator.com/item?id=40166268

Links at the bottom for those of you who'd prefer to skip my long-winded story.

I use a single large(ish) monitor and multiple virtual desktops, or “spaces” as macOS calls them. I have Chrome windows on all of my desktops. When I quit Chrome with ⌘Q and then relaunch it, it collects all of my Chrome windows onto one desktop instead of restoring them to the desktops that they were on previously.

For something like 14 years(!), this has driven me up a wall.

Notably, it doesn’t happen when Chrome relaunches to update itself or when I reboot my machine. In those cases, the app happily restores all my windows to their respective desktops. It’s almost as if it’s taunting me: “oh sure, I can do what you want, I just choose not to sometimes.”

Every once in a while, I go down a rabbit hole, trying to find a solution. I always come up empty-handed. Usually I just find a small handful of other people complaining the same issue. It was never a particularly easy thing to google, and it didn’t help that that it wasn’t clear who was even at fault. Was it a Chrome thing? A macOS thing? Maybe some combination of both? Or even worse, maybe it was a “wontfix, works as intended” situation?

Over the years, I’ve learned to cope. I rarely quit Chrome anyway, aside from updates and reboots, so the itch wasn’t that strong. Or maybe the itch just became part of me. Who knows.

But today, reading this post about things that suck in macOS, I thought of my own thing that sucks in macOS. Like remembering an old friend. An old friend who drove you crazy but who, nonetheless, you cared about.

And today, for old times’ sake if nothing else, I once again googled some combination of the words “Chrome”, “restore”, “windows”, “multiple”, and “spaces”. And folks, this time, I found it.

There’s a setting called NSWindowRestoresWorkspaceAtLaunch. (How had I never found this before? It’s so simple!) You can change the setting for any app, not just Chrome.

https://superuser.com/a/1490087/77154

In case the Stack Exchange network finally succumbs to whims of private equity or otherwise gets lost to sands of time (it’s a fear I have), here’s a gist with the same instructions:

https://gist.github.com/f-steff/0163e0c1ed174e8ab7b33101ab473b5a

I can also put to rest my internal “feature vs bug” debate. Here’s Apple’s response to a bug report from the Chrome team (presumably from before they added the NSWindowRestoresWorkspaceAtLaunch setting):

This issue behaves as intended based on the following: Application restart does not preserve space assignment. We are now closing this bug report.

https://issues.chromium.org/issues/40531488#comment57

0 comments