2

I'm interested in understanding the contents of com.apple.spaces.plist because I'm trying to develop a solution to the problem of restoring apps to their original Spaces after a restart.

Looking at the value of the Space Properties property inside this plist, I see some information that looks relevant to the problem I'm trying to solve:

    "Space Properties": [
      {
        "name": "",
        "windows": [
          8557,
          114,
          183,
          91
        ]
      },
      {
        "name": "40ED97C0-613E-4E9F-ADCB-B0E4A1788987",
        "windows": [
          8557,
          114,
          188,
          337,
          338
        ]
      },
      ...

I assume the IDs under each windows property are the IDs of the applications in each Space. Is that correct?

Can I somehow, by editing this plist after a reboot, restore these window IDs to the Spaces they were assigned to before a reboot, and thus get all my windows back to where they were?

3
  • Instead of 9 lines of python, here's one line that does the same: defaults read com.apple.spaces.plist – user3439894 Apr 15 '20 at 21:19
  • Not that it's not intended for direct use by the public (after all, Apple still needs developers), it's that the documentation would be over at developer.apple.com. I think it's a good question even though it borders on being Software Development (off topic here), but the part about the Python library is irrelevant (and pulls you right into Software Dev territory). Instead stick to the heart of the question: the properties of com.apple.spaces.plist – Allan Apr 15 '20 at 21:21
  • I've updated the question to make it more focused. I originally included the snippet of Python because a) I wanted to show how I got the output I was sharing, and b) my intention was to grow that snippet into a little tool to solve the actual problem I'm interested in. But I agree it's irrelevant to the meaning of the plist. – Nick Chammas Apr 15 '20 at 21:42
1

I assume the IDs under each windows property are the IDs of the applications in each Space. Is that correct?

That appears to be correct. I confirmed this by saving copies of com.apple.spaces.plist over time and matching the changes in its contents to windows I moved back and forth across Spaces. There is a delay of a few seconds from when you move a window to when the plist is updated to reflect that change.

Can I somehow, by editing this plist after a reboot, restore these window IDs to the Spaces they were assigned to before a reboot, and thus get all my windows back to where they were?

This doesn't seem to be possible. The plist appears to be a write-only source of information. That is, the OS periodically writes out what it's holding in memory to this file. But it doesn't update what's in memory by reading from this file.

I tested this on macOS 10.15.4 by making edits to the plist. They were ignored by the OS and simply overwritten with the current state of my windows and Spaces.

You must log in to answer this question.

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