May 29, 2010

Lock your OSX Desktop

Posted by Knick

I love my Mac but there are SOME things i do miss about a PC. Whenever I get up from my desk I lock the screen of my desktop by pressing "Windows L" and decided that I need to be able to do the same on my Mac. After spending about an hour Googling and finding several different ways to accomplish this goal I picked a method that required no 3rd party apps. These are the steps I followed to assign the "lock desktop" function to a keystroke on my Mac.
Open Automator in the Applications folder, and select Service from the screen that appears. At the top of the new Service's actions, in the Service receives drop-down, select no input from the options. Make sure that any application is selected in the second drop-down.

Add the Run Shell Script action (in the Utilities group of actions) to the Service by dragging it to the right. Add the following code:

/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend


Save the Service (Automator does not ask you where to save it, just to name it).

Next, open System Preferences and select the Keyboard preference pane. Select the Keyboard Shortcuts tab at the top, then the Services group on the left. The service you created should be near the bottom of the list of Services under the General disclosure triangle.

Double-click on the right side of the entry for the Service you created and assign a keyboard shortcut. This was a bit unintuitive, because the shortcut column is not distinctly visible, so it is not obvious that you can double-click in the assigned shortcut column to add a shortcut.

Exit the keyboard preference pane to give it a try.

0 comments:

Post a Comment