Re: Getting the desktop background
Re: Getting the desktop background
- Subject: Re: Getting the desktop background
- From: Todd Yandell <email@hidden>
- Date: Mon, 8 Nov 2004 19:28:48 -0600
Hi,
The user's current desktop image is stored in the desktop preference panel's defaults file. This is found at
~/Library/Preferences/com.apple.desktop.plist. The following code will return an NSImage already init'ed with the user's desktop image:
<x-tad-bigger>- (NSImage *)desktopImage
{
NSString *fileName;
fileName = [</x-tad-bigger><x-tad-bigger>@"~/Library/Preferences/com.apple.desktop.plist"</x-tad-bigger><x-tad-bigger>
stringByExpandingTildeInPath];
</x-tad-bigger><x-tad-bigger>return</x-tad-bigger><x-tad-bigger> [[[NSImage alloc] initWithContentsOfFile:[[[[NSDictionary
dictionaryWithContentsOfFile: fileName]
objectForKey:</x-tad-bigger><x-tad-bigger>@"Background"</x-tad-bigger><x-tad-bigger>] objectForKey:</x-tad-bigger><x-tad-bigger>@"default"</x-tad-bigger><x-tad-bigger>]
objectForKey:</x-tad-bigger><x-tad-bigger>@"ImageFilePath"</x-tad-bigger><x-tad-bigger>]] autorelease];
}
</x-tad-bigger> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden