Hi there,
I'm trying to check in a script if the screen of a user is locked. I don't want to display a message with jamfhelper while the screen is locked so other users could click the buttons of the message (for example installing software updates with reboot).
One attempt is to use something like this:
import Quartz; d=Quartz.CGSessionCopyCurrentDictionary(); print d
(source: http://stackoverflow.com/questions/11505255/osx-check-if-the-screen-is-locked)
This works when testing on a local machine but does not work with ssh or policies. I only get back "None" as a result when using it with SSH or Policies.
The other possibility i found is to check if the screensaver process is running. But this does not work when the display is going off because then the screensaver process stops too and the message is displayed immediately after revoking the display.
Does anyone has a working solution to check if the screen is locked?
Thanks.