Search code examples
macoscocoaosx-mountain-lion

Finding Path to Current Desktop Picture


During the pre-sandbox era, there was a way of finding the file path to the current desktop picture. I think one could use Defaults to read com.apple.desktop.plist (Library > Preferences) to see the path. Now, I suppose we aren't allowed to access this file any more. So is there an alternative way of finding the file path to the current desktop picture?


Solution

  • Yup, NSWorkspace has desktopImageURLForScreen: If you've only got one screen, that can be gotten with [NSScreen mainScreen].