• 4
Votes
name

This question is very similar to what I want to accomplish, except for the fact that I also want to be able to put the display to sleep at times without triggering it to ask me for a password. I basically want to be able to do two things:

  • At times, lock the screen, much like I do in a PC by hitting Win+L. I'm fine with the screen going to sleep at this time, and if this step was all I wanted, hitting control+shift+power would do the trick if Require password [amount of time] after sleep or screen saver begins under System Preferences > Security was checked. However;
  • I also want to be able to, sometimes, just put the display to sleep or let it eventually start the screen saver without it asking for a password afterwards. I could also accomplish this one simply, if I unchecked Require password [amount of time] after sleep or screen saver begins under System Preferences > Security, but again that would make me unable to do what I wanted to do above.

I can do this all in Windows by enabling the screen saver, and not checking the box that specifies that it'd get me to the login screen when on resume. That way, I can let the screen saver get triggered and the display eventually go to sleep and it won't ask me for a password when I resume; and I can also simply lock the session when I want to by hitting Win+L, and then the display will eventually go to sleep.

Is this possible to accomplish in a Mac?

Has this issue been resolved in the 10.13.2 public beta? Incidentally, it turns out my RAM was bad and needed a logic board replacement. Now I'm wondering if my user settings have corruption that exploits this bug. You may want to check your RAM too (when turning on computer, hold the D button to run a diagnostic).

I'll also add that while observing events using console, I noticed that right before the screen turns off, I see a notice from powerd that reads "rootDomain's user activity state:0". That's followed by a powerd notice that reads "Display state: Off".

As for having to press the Touch ID button to login (instead of just resting my finger), this behavior was exhibited on a fresh install of High Sierra on a different machine. I'm surprised there aren't more people complaining about it.

  • 1
Reply Report

There are a number of posts (here and here) on superuser.sx.

  • To lock the screen (actually invoking the "Login Window…" action from the User menu, and a direct analog to the Win+L shortcut in Windows):

    /System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -suspend
    
  • To sleep the display (I use this all the time as part of my last command before bedtime on my home machine):

    pmset displaysleepnow
    

Either of these options can be invoked through a keyboard shortcut by tying a shell script to a shortcut (using Automator (like this), Quicksilver, LaunchBar, Alfred, etc., see this post).

It's worth noting that BetterTouchTool can also perform these actions (directly mapping shortcuts to actions like this), as noted in this answer to one of the prior questions). The developer has been giving the app some love recently, which has been wonderful to see.

  • 4
Reply Report