Updated
How to Check if the Screen Is Locked in Shortcuts on Mac
By Sindre Sorhus, who makes the Actions app
With Actions
- Install Actions, and open it once.
- In your shortcut, add the “Is Screen Locked” action of Actions. It has no options.
- Add an “If” action below it that checks if the result is true.
- Put the actions for when the Mac is locked in the “If” part, and the other actions in the “Otherwise” part.
For example, a shortcut that you run on your Mac from your iPhone can stop when you are at the Mac, or show a notification only when the screen is not locked.
Tips
- The action is for Mac. It does not work on iPhone.
- To check if the screen saver is on, use “Is Screen Saver Active”.
Get Actions
Additional actions for the Shortcuts app
Free
- Requires
- macOS, iOS, or visionOS 26 or later
- Privacy
- No personal data collected
- Updated
- June 2026
- US App Store rating
- 4.8/5 (703 ratings)
Without an app
The “Lock Screen” action of Shortcuts locks the Mac, but it does not tell you the state. The “Run Shell Script” action can check it with this command, which gives 1 when the screen is locked and 0 when it is not:
ioreg -n Root -d1 -a | grep -c CGSSessionScreenIsLocked || true
A script needs “Allow Running Scripts”: choose click “Advanced”, and turn it on. The action of Actions is easier, and it gives a true or false value for “If”.
