Add Folder do Desktop Pictures selection

christopher_kac
New Contributor II

Hello everybody,

does someone have a idea how I can remotely add a folder of pictures to the desktop pictures selection?

Appreciate any ideas/feedback, thank you.bfdc49969e5249df8aa911d420f681b4

1 ACCEPTED SOLUTION

rdwhitt
Contributor II

It's in an array so you can try this:

defaults write ~/Library/Preferences/com.apple.systempreferences DSKDesktopPrefPane '<dict><key>UserFolderPaths</key><array><string>/Library/Desktop Pictures/MLW</string></array></dict>'

This worked for me but I had to restart the computer to see the folder listed in the preferences pane.

I'm still not sure why Apple adds the path to both the com.apple.systempreferences.plist and the desktoppicture.db when adding this through the UI. Weird.

View solution in original post

13 REPLIES 13

al_platt
Contributor II

Can you not just drag and drop?

christopher_kac
New Contributor II

Hi al_platt.

sure I can. But not for 100+ Users :-(.
This is why I like to automate this.

rdwhitt
Contributor II

Add the folder and images on an admin machine.
Open up Composer and drag the folder from the finder into the Composer window
Create a pkg and then deploy via policy.

Would that work?

christopher_kac
New Contributor II

Hi rdwhit.

I think I know how to deploy the files to the clients.
But I dont know how to distribute the setting to add the own picture folder to the syspref menu shown above ...

al_platt
Contributor II

Ah, sorry, didn't realise you meant that :0)

Composer doesn't seem to grab a plist when you add the folder.

Must write the setting somewhere though....

Seems there's a string in ~/Library/Preferences/com.apple.systempreferences.plist that holds the path to the folder... Can you grab that and push it out to the machines?

34901b18ac114f248a2f7ad0db1539c3
887ae2ede1994f4084fc32fbfaa2b4de

rdwhitt
Contributor II

Sorry, that's my poor reading comprehension.

This used to be stored in a plist but I think it's writing to the ~/Library/Application Support/Dock/desktoppicture.db. When I add a folder and run a scan I see that getting touched.

rdwhitt
Contributor II

@al_platt Interesting, I didnt see that get touched when I ran a scan but it does have the path there. The desktoppicture.db had the following in it.

INSERT INTO "data" VALUES('/Library/Desktop Pictures/test');

test is the folder I added.

christopher_kac
New Contributor II

Thanks Everybody checking this :-).

Following command did not work for me.

defaults write ~/Library/Preferences/com.apple.systempreferences UserFolderPaths "/Library/Desktop Pictures/MLW"

How can I change the value of UserFolderPaths of DSKDesktopPrefPane of com.apple.systempreferences via command line? :-).

rdwhitt
Contributor II

It's in an array so you can try this:

defaults write ~/Library/Preferences/com.apple.systempreferences DSKDesktopPrefPane '<dict><key>UserFolderPaths</key><array><string>/Library/Desktop Pictures/MLW</string></array></dict>'

This worked for me but I had to restart the computer to see the folder listed in the preferences pane.

I'm still not sure why Apple adds the path to both the com.apple.systempreferences.plist and the desktoppicture.db when adding this through the UI. Weird.

al_platt
Contributor II

@rdwhitt very odd indeed. Oh well, think we've nailed it between us!

dan_berlyoung
New Contributor III

Can somebody get me an updated solution to this? This definitely does not work under Big Sur.

dpratl
Contributor II

If you put a

killall -hup cfprefsd

After the defaults command you don't have to restart or re-login.

@dan.berlyoung: For me it is working on Big Sur as well but what i saw is that I have to use the full path and in the name of the user in my script to get it working, not only ~
Instead of:

defaults write ~/Library/Preferences/com.apple.systempreferences DSKDesktopPrefPane '<dict><key>UserFolderPaths</key><array><string>/Library/Desktop Pictures/MLW</string></array></dict>'

I had to use:

sudo -u "$currentUser" defaults write /Users/"$currentUser"/Library/Preferences/com.apple.systempreferences DSKDesktopPrefPane '<dict><key>UserFolderPaths</key><array><string>/Library/Desktop Pictures/MLW</string></array></dict>'

This is working for me at least on Catalina, Big Sur (Intel and M1)

BR
Daniel

Philein
New Contributor III

Hi everyone. Newbie here :) how do you send this command to users?