Logitech MX Keys: sleep mode keyboard shortcut

As Sleep exists as a menu command, you could make your own…

System Prefs > Keyboard > Shortcuts > App Shortcuts

Select All Applications, press the + button, type Sleep then pick a key command - I'd pick something hard to do by accident, like maybe Cmd ⌘ Opt ⌥ Ctrl ⌃ Shift ⇧ S

enter image description here

I used D in the example image, because I already have S used for Shutdown


Not sure why, but on my side, neither the solution above (maybe because I run French OSX?) nor some other options work well for me.

Anyway, I came with another solution using the Logitech Options application which allows to customize the keys with the actions of your choice. Out of the box, sleep is not available as action in the software of Logitech. But with a very simple Applescript, the magic can happen.

Full solution:

  • open the applescript editor
  • create a new script with 1 line : do shell script "pmset sleepnow"
  • export it as an application (File > Export - then select File format = application)
  • open Logitech Options and customize the key of your choice to launch the application that you just created

I hope it can help.