The specific property in question is not a string but an array of dictionaries.
The minimum python code (at least v3.5 is required) that will print the space names and the window IDs in each space:
#!/usr/bin/env python3
import plistlib
from pathlib import Path
with (Path.home() / "Library/Preferences/com.apple.spaces.plist").open('rb') as fi:
plist = plistlib.load(fi)
spaces = plist['SpacesDisplayConfiguration']['Space Properties']
for space in spaces:
print('name:', space['name'])
print('windows:', space['windows'])
# SAMPLE OUTPUT:
# name:
# windows: [7227, 7168, 5383, 6338, 6202, 5312, 6093, 6755, 6669, 6438, 6314, 4984, 4637, 3916, 6061, 5977, 5973, 80, 6452]
# name: F10F36F4-2698-4DC0-9D1E-769712C306CC
# windows: [5370, 3565, 213, 7190, 6142, 7105, 7146, 5948, 6138, 6141, 6140, 6139, 1353, 4673, 6021, 5925, 1585, 5892, 6453]
This approach will work with both binary and XML .plist files.
A
and the1
and make it 5 shorter🤣 – Cadent