Is there a Api, that can lock the screen as the menu thing you can add from keychain preferences?
A:
I don't see anything documented as such, but the menu uses the ScreenSaver framework, which defines this:
@interface ScreenSaverDefaults : NSUserDefaults
{
@private
NSMutableDictionary *_defaults;
NSMutableDictionary *_registeredDefaults;
NSString *_userName;
NSString *_domainName;
BOOL _dirty;
BOOL _screenLockPrefChanged;
}
+ (id) defaultsForModuleWithName:(NSString *)inModuleName;
@end
Azeem.Butt
2009-12-29 20:06:53
A:
To lock the screen, call:
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
Preston
2009-12-29 22:06:48