Skip to main content
Question

Custom Trigger: Screen Unlock

  • June 7, 2022
  • 1 reply
  • 13 views

Forum|alt.badge.img+4

Hello All

Im trying to use the screen unlock as a custom trigger.  To break it down, I want a package in a policy to install/run when a user logs in (no problem using the login trigger) OR when they unlock their screen.  Any ideas?    

1 reply

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • June 7, 2022

Well, there's no such trigger of course, so this doesn't seem like it will be easy to accomplish.

I think the best you can do is call a policy normally, but use a Before script that loops and checks to see if someone is logged in and their screen is unlocked, and when that condition occurs, continue with whatever it is you're trying to accomplish. But this means keeping a policy "running" for, in some cases, an extended period of time, which isn't really a great idea I think.

In case this helps, there's a post here that has a helpful script for detecting if the screen is locked/unlocked. (not the python one, since python is now deprecated)

https://stackoverflow.com/questions/11505255/osx-check-if-the-screen-is-locked