"Put Computer to Sleep" is Not Working Properly On My System (M1 Max with macOS Monterey)

A macro invoked by a keyboard trigger to put the computer to sleep doesn't work properly. Using KM v. 10.0.2 and Mac specs in subject line.

The behavior: when invoked, screen goes dark momentarily but the computer wakes up right away. Using sleep from the Apple menu dropdown works fine.

The macro has only a single action: "put computer to sleep", triggered by a hotkey Cmd+Shift+Option+S.

Was working fine on old Mac c.2010 running High Sierra (and KM 9.x)

Any idea how to resolve or troubleshoot?

Run this from the Script Editor.app, and see if it works:

tell application "System Events"
   sleep
end tell

Hi,

I am also not able to get the Sleep computer command or the above AppleScript to work properly when a hotkey is pressed on my M2 Mac running 10.6.2.

I should add that when I click on Try Action in the KM Editor it works fine. The command used to work on my previous MacBook.

Any ideas how to get the command to "stick" when I press a hotkey?

The fact that try works but hotkey trigger doesn't suggests you've got a rag in the works somewhere...

  • Make certain your macro actually runs.
    • Macro is enabled.
    • Container macro-group is enabled.
    • Test with a hotkey trigger and a simple Display Text action.

Run the Interactive Help from the Keyboard Maestro Editor's Help Menu.

Thanks for your reply, Christopher. I have followed your suggestions below, including running the Interactive Help, but am still having the same problem. I also run BetterTouchTool and Karabiner Elements, and have quit both apps without any difference.

I note that when I use the hotkey trigger, when I lift my finger off the key—in this case Z—the laptop stays asleep, but when I lift my fingers off the modifier keys the computer comes back to life.

Thanks,
Alan

Post your actual macro...

Thanks for checking, Christopher.

What happens if you change your hotkey trigger to F1?

Same thing.

I just tried F4 (F1 needed to be triggered with the fn key, F4 didn’t), and it worked! I’ll use that.

Many thanks for your help and patience,
Alan

Hey Alan,

I use this setting to flip function keys such that the fn key is not needed, unless I'm activating brightness or other hardware controls.

It makes function keys more useful.

image

When you're having problems with hotkey triggers always try an innocuous single-key trigger like one of the function keys or Home or End to see if the key sequence itself is the problem.

-Chris

1 Like

Thanks for mentioning, Chris. Probably ten years ago I bought the preference pane Function Flip so I could decide how I wanted to use each function key. When it went belly up I switched to Karabiner-Elements. Here’s a screenshot:

Thanks again for your help,
Alan

2 Likes