It is super easy to automatically lock a MacBook after a few minutes of inactivity, but this requires enabling a screensaver.
https://www.google.com/search?q=auto+lock+macbook
However, this method is frustrating, because launching any screensaver appears to take the focus away from the currently active application.
This means if I'm running Chrome, for example, and the screensaver is triggered, I will have to type in my password, and then click anywhere on the screen before I can interact with the Chrome app. If I wanted to open a new tab (CMD+T), pressing these keys on the keyboard does nothing until after I've clicked to regain focus.
Say I have a full-screen terminal window open. After logging back into in, the terminal will not accept any keyboard input until I click somewhere on the screen with the mouse.
Really annoying.
How to get around this?
Automatically locking the computer WITHOUT spawning a screensaver seems like it would work, because locking the computer manually doesn't produce the issue. How to auto-lock without a screensaver?
Best Answer
You could try doing this:
System Preferences > Desktop & Screen Saver (Screen Saver tab) > Start after: never (bottom left)
.System Preferences > Energy Saver
→Turn display off after...
. Both computer sleep and dispay sleep will lock it.I didn't do very extensive testing, but after putting the mac to sleep or just the display and then unlocking the mac, it seems to let me write in the Chrome textarea... just with a little delay, but like you said screensaver doesn't. I don't know if the delay could be due to some of my third party applications, because oddly enough I can start writing immediately and it takes in a few letters, but then stops and after like a second I can start writing again. So I'm thinking it could be an app stealing the focus for a second there...
I use Unlox and I noticed that when it locks my mac even with the screensaver locking, I can start writing just like with sleep. Unlox can lock the computer with or without the screensaver. The main point of unlox is that you can walk away from your computer with your iphone in your pocket and it gets locked when you get far enough (adjustable) and unlocks when you get close enough (adjustable).
I guess I could also add that before I used unlox, I used to use Alfred to lock my computer manually, which has the system commands to put displays to sleep:
sleepdisplays
, or to put the whole computer to sleep:sleep
and alsoscreensaver
, or to just lock the scren:lock
. I think you can use these commands with the free version of Alfred.