Hi,
I'm trying to lock the system when my application starts up. I went with the obvious, executing CGSession -suspend
but that disables the audio system. What I do now is invoking the screen saver and setting the preferences to "require password to unlock".
The problem here however is that I cannot detect when the screensaver unlocks.
This code works mostly, but the screensaver engine shuts down if the user is prompted for the password, killing my program even though it's still active:
int pid = fork();
if (pid == 0) {
system("/System/Library/Frameworks/ScreenSaver.framework/"
"Versions/A/Resources/ScreenSaverEngine.app/"
"Contents/MacOS/ScreenSaverEngine");
kill(pid, SIGKILL);
return 0;
}
Any ideas?