views:

499

answers:

1

How do I get the current wallpaper on a Mac? Just point me to an API function so I can Google more.

Edit: I think I found it. [NSUserDefaults standardUserDefaults] mentioned at http://lists.apple.com/archives/student-dev/2004/Aug/msg00140.html

Also possible from shell: defaults read com.apple.desktop Background

And from AppleScript: http://discussions.apple.com/thread.jspa?messageID=7111272

+1  A: 

You are on the right track. If you write an application in Carbon/Cocoa, just load the preference file. It is located in

/Users/<current-user>/Library/Preferences/com.apple.desktop.plist

The dictionary contains a subdictionary with the key "default" and this sub dictionary contains a key "ImageFilePath", containing the absolute path to the image file.

Mecki