I would like to read settings from Preferences -> Security & Privacy -> General tab in my application. In particular I'm interested if user has set up password and if password is required immediately "after sleep or screen saver begins" or after some delay.
I was able to find when screensaver kicks in by looking at its defaults.
command line: $ defaults -currentHost read com.apple.screensaver
code:
CFPreferencesCopyValue(CFSTR("idleTime"),
CFSTR("com.apple.screensaver"),
kCFPreferencesCurrentUser,
kCFPreferencesCurrentHost);
Using the same reasoning I tried to find plist file for "Security & Privacy" but I'm unable to retrieve this settings from any of the plist files in /Library/Preferences/ or ~/Library/Preferences/.
I'm interested only in reading values. So my question is, can this be done? If yes, how?
If you specify
-currentHostthen the information returned bydefaultsis restricted to preferences operations to the host the user is currently logged in on (these host preferences can be found in~/Library/Preferences/ByHost).So in order to get the information you've asked about:
By omitting the
-currentHostoption it should return:If you wanted to use
CFPrefs:Output:
↳ OSX Man Pages : defaults