Geeks With Blogs
Sean's Blog My Development Blog
Although I've been a Mac user for a couple of years, I recently switched over fulltime to a Mac as my primary development machine at work. There are a lot of things I can get away with on a personal machine that I can't on a work machine (e.g., walking away from my laptop with the screen unlocked).

I was shocked how long it took for me to piece all of the little bits from various Google searches to create a simple keyboard shortcut that allows users to quickly lock their screen, so I thought I would compile it in one [hopefully] simple post.

The following shell command will return the current user to the login screen.

/System/Library/CoreServices/Menu\ Extras/ -suspend

There may be easier/better ways, but I decided to place this command in an Automator script, so launch Finder and open the Automator application.

Choose the Service type at the launch screen:

Automator Launch Screen
Toward the top-center of the window, look for the drown down box next to Service receives and select no input from the drop down list.

Empty Automator Dialog

Under Actions -> Utilities, drag the Run Shell Script task to the right pane.

Paste the following command into task window: /System/Library/CoreServices/Menu\ Extras/ -suspend

Completed Task
Save the script as Lock Screen and quit Automator.

Back in Finder, go to Applications -> System Preferences -> Keyboard and select the Keyboard Shortcuts tab after the application launches.

On the left-hand side, select Services

Scroll to the General category from the right pane and select the Lock Screen service to select a keyboard shortcut.

Simply click the add shortcut button to assign a shortcut. I went with Command + Shift + L, but do whatever makes most sense to you.

Keyboard Shortcut

And that's it! Hope this helps somebody.
Posted on Thursday, December 13, 2012 9:45 AM | Back to top

Comments on this post: Lock OSX With Keyboard Shortcut

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Sean Fao | Powered by: