Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create a screen-locking keyboard shortcut Desktop
I use both an iBook and a Windows-based laptop at work, and it's a must for me to lock the screens on both machines before leaving my desk. I'm a keyboard shortcut junkie, and I quickly became envious of the Ctrl-Alt-Del-Spacebar combo that I could use in Windows XP to swiftly lock the screen (muscle memory is a great thing). So I worked out the following method to enable a keyboard shortcut that locks the screen in OS X -- and no scripting or work in the Terminal is required.
  1. Open the Keychain Access application (/Applications/Utilities/Keychain Access).
  2. Open the Preferences panel (menu: Keychain Access->Preferences).
  3. Make sure "Show Status in Menu Bar" is enabled.
  4. Now close the Preferences panel and then the Keychain Access application.
If you click on the Keychain Access menu extra that should have appeared in the menubar (it looks like a tiny lock), you can try pressing the "Lock Screen" option: this will, as you'd expect, lock the screen.

The next part of this hint involves assigning a keyboard shortcut that will activate the Lock Screen option of the Keychain Access menu extra.
  1. Start System Preferences (/Applications/System Preferences).
  2. Click on Keyboard & Mouse.
  3. Click on the Keyboard Shortcuts panel.
  4. Under Application Keyboard Shortcuts -> All Applications, click the "+" sign (lower left corner) to add a shortcut.
  5. For Application, choose All Applications.
  6. For Menu Title, enter Lock Screen
  7. In the Keyboard Shortcut field, press Control-F9 (press the Control key first, hold it down, then press the F9 key), then click Add.
  8. Before leaving the Keyboard Shortcuts panel, scroll up and find the "Move focus to status menus in the menu bar" entry. On my default install of Tiger 10.4.1, this shortcut is defined as ^F8 (Control plus the F8 key).
Now close System Preferences, then log out and log back into your user acccount. Once you're logged back in, hold down the Control key, press F8, then press F9. If I haven't missed anything, you should now be looking at your screensaver.

[robg adds: You can skip the logout/login step if you open the Terminal and type killall SystemUIServer. When I wanted a fast way to lock my screen, I used Butler to create a keyboard shortcut to the login window -- when I press my shortcut keys, up pops the login window. However, the method in this hint works, doesn't require any third-party software, and it's free...]
    •    
  • Currently 3.14 / 5
  You rated: 3 / 5 (7 votes cast)
 
[88,727 views]  

Create a screen-locking keyboard shortcut | 50 comments | Create New Account
Click here to return to the 'Create a screen-locking keyboard shortcut' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a screen-locking keyboard shortcut
Authored by: wildo on Jul 15, '05 08:13:36AM

how about just creating a hot corner and setting the screensaver to that corner . . a swift movement of the mouse would start the screensaver!! That's what I do at work to stop students accessing my login!

---
May the X be with you!!



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: morespace54 on Jul 15, '05 03:50:34PM

or try: SHIFT+CMD+Q
or better yet: SHIFT+OPTION+CMD+Q

that should bring you back to the login window...



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: tak on Jul 16, '05 06:03:21AM

These shortcuts will log out and quit all running apps. But the goal of this hint was to keep them running and prevent access to the computer so that one can easily resume work.

Logging out and locking screen is not the same thing.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: marook on Jul 16, '05 08:47:56AM

Ahh, no they won't. Using Fast User Switching will not Close your account, but log out to the Login panel. Your app's keep running!
Only if you choose Log Out from the Apple menu, will you close your account and quit running apps...

---
/Marook



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: tak on Jul 16, '05 06:53:22PM

> Ahh, no they won't.

Yes, they do.

Shift-Cmd-Q and Option-Shift-Cmd-Q quit running apps and log out w/ and wo/confirmation dialog.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: machard on Jul 18, '05 12:23:23AM

He's right Marook. Sorry man.

The only way to user switch with out logging out is by choosing a different user from the fsu menu.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: Explosiv0SX on Jul 15, '05 08:20:41AM

Don't forget to make sure you command drag the keychain menu status item to be the leftmost item. This is the only way I could get this hint to work.

Is it me or is the OS X shortcut keys functionality lacking? Why do I need a 3rd party utility to bind cmd+opt+ctrl+t to launch the terminal app? You'd think we would have seen some improvement from Panther to Tiger in this area, but alas, nothing. If I'm missing something, please feel free to enlighten me. Don't know why someone would need this? Imagine being able to create a universal shortcut to an applescript or launching your address book from anywhere with cmd+opt+ctrl+a.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: KenaiTheMacFan on Oct 23, '05 05:18:11PM

>Why do I need a 3rd party utility to bind cmd+opt+ctrl+t to launch the terminal app?

You can use One Key, Spark, Quicksilver, etc. to do this.

---
Ian



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: Anonymous on Oct 23, '05 07:23:01PM

Yes. And all of those are third-party utilities.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: knifehandchop on Jul 15, '05 08:29:55AM

The problem with a hot corner is that (and try as they might, I don't think Apple will get round it) screens have just four corners, and there are 5 expose features including dashboard. Plus on a laptop it can be tough to nail hot corners - as well as activating them accidentally being really annoying.

I recently came up with my own way around this, which was to go to

System/Library/Frameworks/Screensaver.framework/Versions/A/Resources/ScreenSaverEngine.app

Then opt-command drag the app to the desktop. Cmd-i it to enter something like "sss" (start screen saver) in the spotlight info, now ctrl-space, sss, cmd-enter and bingo, screensaver is up. Might save some people out there valuable menu bar space if you don't want Keychain Access up there.

I only aliased the app as I don't think Spotlight will search the System folder, but I guess you can move it anywhere in your home folder.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: Degheygh on Jul 18, '05 10:46:26AM

On "start screen saver", "not using Hot Corners", keyboard shortcut, one-click, quick-start, easy access:

Drag the ( System/Library/Frameworks/Screensaver.framework/Versions/A/Resources/ScreenSaverEngine.app ) to the Dock.

Click on shortcut in Dock to start Screen Saver.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: haloici0us on Jul 25, '06 10:29:58AM

I was able to use this tip to make Mighty Mouse activate the screen saver.
I wanted to use the side buttons, since I don't use them for anything else.

I simply assigned that app to the side buttons and it works perfectly fine in addition to the lower right corner that I use to activate it as well.

I can move my mouse or I can simply now use the side buttons.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: ljharb on Sep 08, '09 08:54:51AM

Or, when setting a screen corner in Exposé, you can use any modifier keys you like on your hot corner.

My screen saver only activates when I hold down the command key and put the mouse in the upper right corner.

With modifiers, there are something like 64 possible combinations.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: lik3n on Jul 15, '05 10:31:54AM

You could just hit Windows Key + L to lock your windows box.

That seems easier to me.



[ Reply to This | # ]
Also with Quicksilver + AppleScript
Authored by: gullevek on Jul 15, '05 10:37:35AM

I think I read this here, but I can't find it in the archives. Perhaps it was some place else.
Anyway, for ths you need Quicksilver and this little apple script:

tell application "ScreenSaverEngine"
activate
end tell

1) Save that in an applescript somewhere.
2) Then open the Quicksilver preferences and go to Triggers.
3) Add a new trigger by clicking on the plus Icon
4) Type in the name of your script and select it (you might need to rerun your indexing for quicksilver so it gets the script)
5) You can now add any keyboard shortcut you like (I have ctrl+cmd+L).

Thats it, now you can lock your screen with a shortcut.

But I agree having a hot corner is the quickesway. :)



[ Reply to This | # ]
Also with Quicksilver + AppleScript
Authored by: DocMan on Jul 15, '05 11:55:01AM

Couldn't you just set up the same keyboard shortcut through the keyboard preference panel? Just save your script as an app.

Doc



[ Reply to This | # ]
Also with Quicksilver + AppleScript
Authored by: mingking on Jul 15, '05 12:36:45PM

Unless I'm missing something about what you're saying, you can't set Keyboard Preferences to launch an app. You can only set it to execute a menu item by name of an already running app.

I guess the third-party guys are happy with the current state, but it seems that Apple already has a nice GUI for assigning keystrokes globally or per Application, but the implementation is pretty weak. When they first introduced it I thought they were going to make it a full blown centralized keystroke assignment/action customization system, but instead you've got a hodgepodge of things like Keyboard Prefs bindings (weak), the global AppleScript menu (can do just about anything, but no keyboard assignments), and Automator workflows (good for adding contextual menus, but again, no keyboard assignments). All of these should interoperate better.



[ Reply to This | # ]
Also with Quicksilver + AppleScript
Authored by: DocMan on Jul 18, '05 12:54:13PM

Enable the Script menu, and make sure that your applescript is in the menu. Then Keyboard shortcuts can launch the app.

I'll admit I haven't tried this, but it should work.

Doc



[ Reply to This | # ]
Also with Quicksilver + AppleScript
Authored by: gullevek on Jul 17, '05 09:18:09AM

I don't know. For me it always has side effects. I set a zoom global shortcut, but instead of zooming only the front window, like the menu point does when going throught the menu, it zooms all windows.
So I don't even bother with these settings anymore.



[ Reply to This | # ]
Quicksilver defualts
Authored by: dudemac on Jul 15, '05 12:32:39PM

Ok, I don't know why this hasn't been mentioned yet, but if you have Quicksilver installed one of the default apple script actions is "Fast Logout" as in fast user switch to the login screen. So in less than four key strokes my computer is locked at the login screen and all my programs stay running. Plus its more secure than the screen saver.

I can't recommend enough the Quicksilver program. It saves me so much time and I am constantly learning of new functionality. I hardly use the finder or spotlight, but I use QS all the time.



[ Reply to This | # ]
Quicksilver defualts
Authored by: gullevek on Jul 17, '05 09:15:34AM

same here. I never use spotlight, because I know where my stuff is and for starting programs QS is just 1000 times faster. plus it lets my type in stuff and doesn't need to search an endless time.



[ Reply to This | # ]
Quicksilver defualts
Authored by: gullevek on Jul 17, '05 09:21:43AM

Why should fast logout be more secure than a screensaver? If I turn of fast user switching and I lock my PC with the screensaver than only I can access it and nobody can login with some other account that might be there.



[ Reply to This | # ]
Quicksilver defualts
Authored by: seamus on Aug 18, '05 12:29:34AM

I agree. Quicksilver is probably the most useful app around. I've solved this issue for myself by having it the launch the Screen Saver Engine by typing "SS".

---
Seamus



[ Reply to This | # ]
Also with Quicksilver + AppleScript
Authored by: KenaiTheMacFan on Oct 23, '05 05:10:14PM

Couldn't you launch the script with One Key or Spark or some other keyboard file-launching utility? I have One Key and Quicksilver but I have never even opened Quicksilver.

---
Ian



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: jtrump on Jul 15, '05 12:47:58PM

I know that this is a Mac site, but I couldn't help but provide a Windows tip. Instead of Ctrl+Alt+Del+Space to lock your WinXP machine, you can just use windows+L.



[ Reply to This | # ]
Doesn't work as expected...
Authored by: lullabud on Jul 15, '05 12:48:27PM

I have been looking for something to do this ever since I bought my first Mac. Coming from windows, I used to use Win-key-L to lock the screen, which is separate from the screen-saver password. I expected this hint to do that, but it doesn't... =/

When I tried this hint I had my screensaver password enabled since I just use a hot-corner to lock my system right now. I put the lock thing up there, hit "lock screen" and sure enough, it worked. Woohoo, right? Well, since I didn't need to lock with the screen-saver activation anymore, I turned off needing a Password to wake from sleep or screensaver. All the sudden locking the screen does not lock the screen. It simply turns on the screensaver... So, basically it seems to have the same function as the hot-corner. Very lame...



[ Reply to This | # ]
Alternative
Authored by: PopMcGee on Jul 15, '05 01:13:32PM

1. In System Pref "Security", choose "Require password to wake"
2. When you leave the desk, press the power button, followed by "s"

Cheers :-)



[ Reply to This | # ]
Alternative 2
Authored by: allanBook on Jul 15, '05 01:30:09PM

If you still need processes to run but need the computer locked, if you have fast user switching enabled:

1. click on fast user switching icon/name on menu screen
2. select login window

And there ya go. You'll then have to select your username and enter a password (if you have one) in order to get back into your system.

BTW, the hint claims it's a keyboard shortcut, but if one is lifiting one's hand off of the keyboard to click on something, that's not really a keyboard shortcut now, is it?

---
"Mr. Simpson, this is the most blatant case of fraudulent advertising since my suit against the film The NeverEnding Story." -Lionel Hutz (of Simpsons fame)



[ Reply to This | # ]
Alternative
Authored by: KenaiTheMacFan on Oct 23, '05 05:16:11PM

This only works on laptops. To get the same dialog on a desktop Mac, press Control-Eject. On desktops, the power button instantly puts the computer to sleep.

---
Ian



[ Reply to This | # ]
Alternative
Authored by: edmechem on Oct 25, '05 02:35:23AM

Actually, that behavior can be changed in Energy Saver. On non-laptops, there's an option to have the Power button Sleep the computer - just uncheck that option. Now, the Power button will function the way it does on laptops; it'll bring up the Sleep, Restart, Shutdown or Cancel dialog.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: Riker29 on Jul 15, '05 01:24:35PM

"Open the Preferences panel (menu: Keychain Access->Preferences)."

I don't see a "Preferences" menu option ....

Is this possible a Tiger-only hint? (I am using Panther, 10.3.9).



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: jwoolson on Jul 15, '05 01:55:36PM

Yes, those are Tiger-only steps. Sorry.

---
Jonathan Woolson
www.thinkplaydesign.com



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: nemoinis on Jul 16, '05 01:57:35PM

In Panther, choose "Show Status in Menu Bar" from the View menu in Keychain Access.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: zo219 on Jan 25, '11 03:39:29PM

I think what is meant is that the Keychain Access application has preferences to set — and, BTW, the essential Keychain check and repair.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: kwsanders on Jul 15, '05 01:40:12PM

Nice tip. Just a quick note on the Windows lock, by the way... if you have a keyboard with the Windows key on it, just the Windows key plus L to lock the display. Much simpler than doing the Ctrl-Alt-Del and then L.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: ChrisAllison on Jul 15, '05 04:03:39PM
Yellow Mug software's SizzlingKeys (previously SizzlingKeys for iTunes) is, IMHO, an excellent pice of software. It's a preference pane managed freeware daemon for controlling iTunes with user assignable hot keys, but it has the advantage of also having an assignable screen lock hot key, which actives the Mac OS X fast user switching login dialog. Fn + F2 on my powerbook locks the screen quickly, easily, and more securely than the screen saver password dialog.

Oh yeah, and since everyone else is saying it: windows key + L will also lock your screen in windows (not that I knew that before reading it four times in the comments, but I wanted to sound like all the other kids).

[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: wgscott on Jul 15, '05 05:35:42PM

Building on the above hint, get the application OnMyCommand and create a contextual menu item that runs the command

open /System/Library/Frameworks/Screensaver.framework/Versions/A/Resources/ScreenSaverEngine.app

Then you can lock the screen (assuming you have set it to do so) with a click of the right mouse button (or control-click for a one-button mouse).



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: marook on Jul 15, '05 05:53:32PM

Here's another one.
If you use FUS, get WinSwitch, and it also have a [assignable] hot-key to move to the Login-panel.

Works nicely..

---
/Marook



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: infodriveway on Jul 15, '05 08:29:57PM

This is what I do! I use FruitMenu to redo my Apple menu, changing Log Out to Command-Option-Shift-Q. Then I set up WinSwitch to go to the login window with Command-Shift-Q. It is great!

---
there is nothing special about equal rights.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: morespace54 on Jul 15, '05 09:03:49PM

or try: SHIFT+CMD+Q
or better yet: SHIFT+OPTION+CMD+Q

that should bring you back to the login window...



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: tak on Jul 16, '05 06:04:50AM

These shortcuts will log out and quit all running apps. But the goal of this hint was to keep them running and prevent access to the computer so that one can easily resume work.

Logging out and locking screen is not the same thing.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: rhowell on Jul 16, '05 01:33:42PM
Please, on your computer, type shift-command-q. Does a dialog box come up stating "Are you sure you want to quit all applications and log out now?"

If not, you've installed some haxie and you're spacing out. If so, you're not understanding the hint.

[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: tak on Jul 16, '05 07:36:12PM
Yes, of course the dialog box comes up. That's exactly what I was saying. And it's exactly what this hint is not about. And just that I was saying.
Well, in the mean time I came up with another idea:
Bind
/System/Library/CoreServices/Menu\ Extras/user.menu/Contents/Resources/CGSession -suspend
with QuicKeys to a hotkey of your choice
or add the following line to your ~/.profile
alias lock='/System/Library/CoreServices/Menu\ Extras/user.menu/Contents/Resources/CGSession -suspend'
so you can lock your screen from any terminal window with 'lock'.

[ Reply to This | # ]
Try LockTight
Authored by: makeinu on Jul 16, '05 09:11:00AM
Alex Harper, the developer at Raging Menace, once made an app named SleepTight for Jaguar, but stopped development on it when Panther included lock on sleep functionality. Menno Pieter modified the code to include only the keyboard shortcut, and released it as a preference pane. You can find it here, at the bottom of the page on the right. Simple, and it works.

[ Reply to This | # ]
Try LockTight
Authored by: osxpounder on Jul 18, '05 05:36:18PM

makeinu, thanks for that link to "LockTight". That's the perfect solution. System-wide, the hotkey works and engages the screen saver [which I've set to require a password]. Perfect!

---
--
osxpounder



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: mirrorspock on Jul 21, '05 04:43:43AM

just a quick tip for your XP Laptop in stead of <ctrl>-<alt><delete> then Space you could just use <windowskey> + <L> to lock it



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: derekhed on Jul 21, '05 06:03:25PM

Why not just use apple-shift-Q?

And I lock my windoze box with the windowskey-L...

Heh heh heh!
:-)



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: zbender on Nov 22, '06 09:25:24PM
..or use the version of LockTight I recompiled for Intel at my blog?

http://www.gkoya.com/2006/11/23/locktight-for-mac-os-x-intel/


[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: zyxw59 on Oct 30, '09 10:22:06AM

Has anyone on a laptop ever tried closing the lid? That puts the computer to sleep.



[ Reply to This | # ]
Create a screen-locking keyboard shortcut
Authored by: Casemon on Jan 25, '11 09:26:45AM

CMD+OPTION+EJECT puts system to sleep. Combine this with "Enable password on awake" in Prefs->Security and there you go!



[ Reply to This | # ]