How to set desktop wallpaper and screen-saver from cocoa app?
+1
A:
If you're on Mac OS X 10.6, NSWorkspace has some new methods for setting the desktop picture. The one you want is setDesktopImageURL:forScreen:options:error:.
As for screen saver, there's no supported way to do this programatically. You could modify the com.apple.screensaver plist file and set the following keys:
- moduleName <-- screen saver name
- idleTime <-- interval in seconds
- modulePath <-- path to screen saver file
However, this could break at any time so I would not rely on it.
macatomy
2010-03-29 16:25:25
I need setting wallpaper on previous MacOSX too
e40pud
2010-03-29 19:33:23
You could use something like NSAppleScript and then use AppleScript to change the wallpaper: http://still-scripts.com/applescript/change-your-desktop-background-with-applescript/
macatomy
2010-03-29 21:50:56