For years, I’ve used Applescripts to test if my Mac’s monitor is locked (to not be confused with checking if the display screen saver is lively. I haven’t got the display screen saver lock the display screen since I take advantage of the display screen saver as an enormous clock after I’m residence and I lock the display screen after I depart).
Both the swap to Apple silicon or a Mac OS replace has stopped scripts like this from checking if the display screen is locked:
set isScreenLocked to do shell script "pmset -g ps | awk 'NR==2{print $2}'"
Scripts like this do not appear to work on Apple silicon both:
set isScreenLocked to do shell script "ioreg -n IODisplayWrangler | grep -i IOPowerManagement"
I am working Mac OS Sonoma on an M1 Mac studio. How can I take advantage of Applescript to test whether or not or not the display screen is locked (once more, to not be confused with the display screen saver being lively)?