Last active
September 26, 2019 20:25
-
-
Save pudquick/9060571 to your computer and use it in GitHub Desktop.
Modify the per-user picture folders suggested in "Desktop & Screen Savers"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from CoreFoundation import CFPreferencesCopyAppValue, CFPreferencesSetAppValue, CFPropertyListCreateDeepCopy, kCFPropertyListMutableContainersAndLeaves, CFPreferencesAppSynchronize | |
| folder_to_add = u'/Abosulte/Path/To/Folder' | |
| desktop_settings = CFPreferencesCopyAppValue('DSKDesktopPrefPane', 'com.apple.systempreferences') or dict() | |
| mutable_desktop_settings = CFPropertyListCreateDeepCopy(None, desktop_settings, kCFPropertyListMutableContainersAndLeaves) | |
| folder_paths = mutable_desktop_settings.get('UserFolderPaths', list()) | |
| if folder_to_add not in folder_paths: | |
| folder_paths.append(folder_to_add) | |
| mutable_desktop_settings['UserFolderPaths'] = folder_paths | |
| result = CFPreferencesSetAppValue('DSKDesktopPrefPane', mutable_desktop_settings, 'com.apple.systempreferences') | |
| result = CFPreferencesAppSynchronize('com.apple.systempreferences') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment