Screensaver settings spontaneously revert

screensaversettings

I have my screen saver set to display images from a folder in my ~/Pictures directory, and the "Shuffle slide order" box is checked. In Yosemite, I find that occasionally one or both of those settings will revert to the defaults; the "Source" menu will revert to "National Geographic", the "Shuffle slide order" box will be unchecked, or both.

Is there any reason these settings should be changing without my intervention? Is there any way I can monitor the settings (such as in a system log somewhere) to find out more about when this happens and why? Is there a default write command I can execute to make my desired settings the default?

Best Answer

(Answering my own question)

This problem never went away for me, but I do have a workaround. I found the preferences that kept changing were in com.apple.ScreenSaverPhotoChooser. I set everything the way I wanted it in System Preferences, then read all the values from that preference file with

defaults -currentHost read com.apple.ScreenSaverPhotoChooser

I then copied all those values into a script that would write them back to the same preference file whenever it spontaneously changed its values.

#!/bin/bash
defaults -currentHost write com.apple.ScreenSaverPhotoChooser CustomFolderDict -dict identifier \"/Users/me/Pictures/MyFolder\" name MyFolder
defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedFolderPath \"/Users/me/Pictures/MyFolder\"
defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedSource -int 4
defaults -currentHost write com.apple.ScreenSaverPhotoChooser ShufflesPhotos -bool true

(I may be able to combine all those lines into one line; I am not sure about that and haven't tried it.)

I saved the script as ~/bin/screen-saver-prefs and made it executable. Whenever I happen to notice that my screen saver is not doing what I want, I just open up a terminal and run screen-saver-prefs at the prompt. ~/bin is on my PATH, so I don't need to reference the directory. If you don't want to do that, just use the full path to the script to run it.

It's not the most elegant or efficient solution, but it works.