I'm trying to get information about the current Mission Control Spaces, specifically the current space number. I can access this info by using "defaults read com.apple.spaces". The problem is that this info only seems to update when a new space is created or deleted. So if you read this and then change the current space or open a new window, that file will still be set to the previous space until a new space is created or deleted, which would then update the file. I can't see any other way to get this information.
Is there any non-intrusive way to force the OS to update this plist file on demand (without relaunching the dock or Finder)? Or is there any other way to get the current space number any other way? Thanks