I have the
Require password 4 hours after sleep ... option in
Security and Privacy System Preferences set and am running a script with
launchd to suspend my session at a certain time of day (see this question for details). The result is (when the time span and specific time of day overlap) is that my account is doubly-locked, one for each action, requiring password entry twice.
Is there a way to check (for example in a shellscript or Applescript) whether or not my account is already locked before calling
/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -suspend command?