0

Is there a way under MacOS Big Sur (11.7.3) to detect when power-saver mode has kicked in and the screen has turned off?

I want to have a special utility run every time the screen turns off.

Is this possible?

Thank you very much in advance.

1 Answer 1

1

The NSWorkspace notification NSWorkspaceScreensDidSleepNotification is issued when the display sleeps.

For a CoreFoundation approach see the Stack Overflow question Check if display is at sleep or receive sleep notifications.

2
  • Thank you! That discussion refers to a "sleepwatcher" command, and it's exactly what I need. I'll test it when I can return to my Mac later this week.
    – HippoMan
    Jan 31, 2023 at 15:35
  • And I've now been able to test "sleepwatcher", and it works perfectly on my Mac. Thank you again!
    – HippoMan
    Feb 1, 2023 at 23:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .