• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?


  • Subject: Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?
  • From: Jonathan Hendry <email@hidden>
  • Date: Sun, 1 Jul 2001 23:21:27 -0500

On Sunday, July 1, 2001, at 06:31 , David Remahl wrote:

Uhm, actually it is a Finder thing...Finder is responsible for the desktop and it does what it sees fits with the background...Finder stores its preferences for the desktop in this structure in its .plist preferences file:

DesktopViewOptions = {
ArrangeBy = grid;
BackgroundFlags = 0;
BackgroundPictureURL = "file://localhost/Users/chmod007/Pictures/Familjebilder/Digitalkamera Tacha/
MVC-020S.JPG";
BackgroundType = PctB;
IconSize = 32;
};

But I dont think that that is anything you should go in and modify since the format may change in the future...

You can change it through NSUserDefaults. In Objective C the
code looks something like this:


NSUserDefaults* defs = [[NSUserDefaults alloc] initWithUser:NSUserName()];
NSMutableDictionary* finderDefs = NULL;
[defs addSuiteNamed:@"com.apple.finder"];

viewDict = [defs dictionaryForKey:@"DesktopViewOptions"];

finderDefs = [[defs persistentDomainForName:@"com.apple.finder"] mutableCopy];

if (NULL != viewDict)
{
NSMutableDictionary* mCopy = [viewDict mutableCopy];
NSURL* url = [NSURL fileURLWithPath:newPicture];
[mCopy setObject:[url description] forKey:@"BackgroundPictureURL"];

[finderDefs setObject:mCopy forKey:@"DesktopViewOptions"];
[defs setPersistentDomain:finderDefs forName:@"com.apple.finder"];
[defs synchronize];
}


A change would also require a restart of finder...

Yep. You can change the default, then use the Force Quit
panel to relaunch Finder. You'll see the new image when it
restarts.

I doubt it, but maybe finder supports changing the background using applescript...

Nope. Not yet, anyway.

- Jon


  • Follow-Ups:
    • Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?
      • From: Finlay Dobbie <email@hidden>
References: 
 >Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java? (From: David Remahl <email@hidden>)

  • Prev by Date: Re: AppKit source available as reference?
  • Next by Date: NSEditText will not be enabled
  • Previous by thread: Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?
  • Next by thread: Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?
  • Index(es):
    • Date
    • Thread