Posted on 07-20-2023 06:57 AM
I just ran in a changed behaviour with the defaults command.
I have a script that adds a folder to the list of background pictures. It worked fine until macOS 13.2 I think. Never checked after that. Just saw the new behaviour while looking for ways to have a different lockscreen picture than the desktop picture. (Spoiler: It's not possible.)
Normally the script simply runs this command in the user context:
defaults write com.apple.systempreferences DSKDesktopPrefPane -dict "UserFolderPaths" "( 'path_to_my_wallpapers' )"
This updated the plist file below and the user saw the folder with additional company wallpapers.
~/Library/Preferences/com.apple.systempreferences.plist
Now the command writes to the sandbox container. And whats more worse, the user does not see the folder in System Preferences
~/Library/Containers/com.apple.systempreferences/Data/Library/Preferences/com.apple.systempreferences.plist
So, currently I don't see a way to write my setting using the preference domains with the defaults command. I'll have to write directly into the file and crossing fingers 'cfprefsd' will not revert the command.
Anyone else experiencing this?
07-20-2023 08:57 AM - edited 07-20-2023 09:13 AM
I created a profile with the Applications & Custom Settings payload - Upload. I used this plist. I entered the path to the folder with a lot of wallpapers into the string. I scoped it to my MacBook Pro. After confirming that the profile installed, I quit and relaunched System Settings, then went to change my wallpaper. The folder I entered into the plist was there. I was able to add additional folders, so users won't be restricted from adding what they want.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DSKDesktopPrefPane</key>
<dict>
<key>UserFolderPaths</key>
<array>
<string>PATH TO FOLDER WITH WALLPAPER</string>
</array>
</dict>
</dict>
</plist>
Posted on 07-26-2023 08:33 AM
My post was more about the change default behaviour.
But thx anyway, great idea. Will test this. :)
Posted on 07-27-2023 12:23 PM
I understand. Your post reminded me of when I wanted to set Finder preferences to display the path bar. The default write command just wasn't doing it reliably, so I turned to using a configuration profile instead. It worked very well.