6

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?

3
  • In addition to the options suggested on the linked question, you can make use of Alfred and that tool allows one to activate the screen saver. Not quite the short cut you looking for, but another option. I have it set to sc so after activating Alfred, I just type that combination and press enter.
    – Alain King
    Commented Jun 19, 2015 at 14:03
  • The reference to Windows does not help me (I do not have it), but are you asking to have 2 screen saver modes, one with password one without ? and the the way to trigger one or the other.
    – Ruskes
    Commented Jun 19, 2015 at 15:14
  • @Buscar웃SD I guess that could be a way to look at it, yes.
    – JNat
    Commented Jun 19, 2015 at 16:23

2 Answers 2

2

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
  • 1
    Is there any difference between what you mention in your second bullet point and just hitting control+shift+power?
    – JNat
    Commented Jun 24, 2015 at 12:07
  • As far as I know, Ctrl+Shift+Eject (or Power) actually puts the machine to sleep (pmset sleepnow). On the other hand pmset displaysleepnow just turns off the screen. As noted below, this action can be tied to a hot corner. Screen locking will occur according to the settings in the Security & Privacy prefpane on displaysleep. Commented Jun 24, 2015 at 12:15
  • 1
    According to this page, control+shift+power should just put the display to sleep.
    – JNat
    Commented Jun 24, 2015 at 12:35
  • Ahh, noted. Seems that way. I'll have to check this on my iMac at work… it didn't seem to work yesterday. It does work just fine on my home MBP (used in clamshell with external Apple keyboard and display). I was only aware of the sleep combo(Cmd+Opt+Eject/Power), so thanks for pointing that out! Commented Jun 24, 2015 at 12:41
2

here is a solution, with mouse movements (not keyboard shortcuts).

FOR THE FIRST PART

Go to user & groups

users groups

Enable fast switching.

enter image description here Whenever you need to activate the login screen click login screen on top right. It will need the login password to open again.

enter image description here

(If you still need to define keyboard shortcut, please look this link, though I didn't test it, but it might probably work.

http://www.macyourself.com/2013/01/27/how-to-lock-your-mac-screen-with-a-keyboard-shortcut/ )


FOR THE SECOND PART

Disable "require password" option security & privacy section.

1- In system preferences, select Mission Control,

select mission control

2- Then click on hot corners on lower left

click on hot corners

3- From there define your actions by assigning actions to each screen of your mac

hot corners of screen

4- Here are the standard actions of mac, when you move your mouse to those corners of screen

actions defined

And next time when you move your mouse, your screen saver will be activated.

3
  • 1
    How does this work for the second part of the question (sleep display or start screensaver without requiring a password)? Commented Jun 24, 2015 at 3:54
  • It doesn't work for the second part of the question.
    – JNat
    Commented Jun 24, 2015 at 11:51
  • indeed. i missed 'without' part. i revised my post. @DustinWheeler @JNat♦
    – auludag
    Commented Jun 24, 2015 at 18:56

You must log in to answer this question.

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