Lock screen shortcut on Mac OS X

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:

  1. Create a new Service.
  2. Choose no input next to “Service receives”.
  3. Search Launch Application next to the Actions and Variables buttons, and double-click it.
  4. Click the application, go to Other…, and choose Lock Screen Bundle from lock-screen-app in Documents (or wherever you chose to build it).
  5. Save your new Service as lock-screen.1

Screen Shot 2017-02-15 at 5.50.17 PM.png

Finally, open System Preferences… > Keyboard > Shortcuts > Services > General and assign the shortcut you want.

Screen Shot 2017-02-15 at 6.10.46 PM.png

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s