If you’re like me, you like being able to lock your Mac with a single keypress, but you can’t just trigger the screensaver, and you don’t want to kill your processes + network by sleeping your computer. Apple have been trying their best to make this really hard with El Capitan, but never fear! With a single open-source app and a couple of built-in Mac apps, you can get things up-and-running in just a few minutes.
First, open your Terminal, and clone and build gaomd / lock-screen-app:
cd ~/Documents git clone https://github.com/gaomd/lock-screen-app.git cd lock-screen-app ./build.command
Next, fire up Automator:
- Create a new Service.
- Choose next to “Service receives”.
- Search Launch Application next to the Actions and Variables buttons, and double-click it.
- Click the application, go to Other…, and choose Lock Screen Bundle from lock-screen-app in Documents (or wherever you chose to build it).
- Save your new Service as lock-screen.1
Finally, open System Preferences… > Keyboard > Shortcuts > Services > General and assign the shortcut you want.
Bingo! A working lock screen shortcut key.
1 You can use any name, really, but be sure to avoid spaces, as otherwise you’ll hit a perennial Mac OS X bug.