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

Create key-based sleep and lock shortcuts Desktop
After switching to MacOS a year ago, I found that I missed being able to lock my workstation with a key combo. Here's my solution. I rely on a fantastic piece of shareware from Unsanity called FruitMenu which, in addition to bringing back the Apple Menu, allows me to assign keyboard shortcuts to any application. It's $7 well spent. With FruitMenu and the keyboard, I can:
  1. Sleep
    FruitMenu has a menu item for sleeping by default. I added it to my menu and assigned a key combo to it. Note: I've found that key combos that use the [command] key do not always register. This may be a bug, but more likely, it's due to a foreground app taking priority for the key combo. Hence, I assign combos with [ctrl] and [option] together.

  2. Lock
    Locking is implemented through the Screen Saver as usual. I set my Screen Saver to "Never" launch in the preferences, but to require a password. Then I dragged /System -> Library -> Frameworks -> ScreenSaver.framework -> Resources -> ScreenSaverEngine to the FruitMenu. I renamed it to "Lock Workstation" and assigned a key combo.

  3. Both sleep and lock
    Open the AppleScript Script Editor and enter the following script:
      launch application "ScreenSaverEngine"
    delay 5
    tell application "Finder"
    sleep
    end tell
    Then Save As Run-Only, select "Application" under Format, and check "Never Show Startup Screen." I saved it as "Lock & Sleep Workstation". For vanity, I changed the icon to the Keychain icon as well. Finally, I dragged my newly created application to my menu and assigned it a key combo. Naturally, you can also put this application into your dock and launch it from there, or any other launcher application.
I hope this hint is helpful and is not a repeat of a previous hint.

[Editor's note: I think bits of this have been repeated in previous hints, but this is a nice summary of three different keyboard-based solutions for sleeping and/or locking your machine.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[13,526 views]  

Create key-based sleep and lock shortcuts | 8 comments | Create New Account
Click here to return to the 'Create key-based sleep and lock shortcuts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Built-in sleep from keyboard
Authored by: xil on Nov 20, '02 11:02:40AM

There's an easier way to put the machine to sleep from the keyboard--2 keys and no extra software needed. You need a keyboard with a power key, or a Powerbook with a power key on top, though.

Press the power key; a dialog box will pop up asking if you want to sleep or shut down or restart or what. Just press 's' for sleep, and there you go.



[ Reply to This | # ]
Built-in sleep from keyboard
Authored by: jda on Nov 20, '02 11:43:43AM

On newer keyboards without a power button, hit ctrl-eject and then s.

There are other ctrl-eject shortcuts that work immediately:
ctrl-cmd-eject restarts and
ctrl-opt-cmd-eject shuts down.

As for the screensaver thing, you can always set up a hot corner.



[ Reply to This | # ]
Built-in sleep from keyboard
Authored by: adamk on Nov 20, '02 11:54:26AM

it's not keyboard based but a nice way to lock your screen is to enable the keychain access menu item. there is an option called "Lock screen". it launches the screen saver and requires a password. the nice thing is that it doesn't change your screen saver preferences permanently, just that one time.



[ Reply to This | # ]
Some shortcuts are already there
Authored by: jecwobble on Nov 20, '02 11:53:49AM

I don't know if this works in 10.2, but in 10.1.5 all the following work for me:

option + command + eject = sleep immediately
control + command + eject = shutdown and reboot immediately
control + eject = shutdown/restart dialog box
control + option + command + eject = shutdown

Granted, sleeping immediately doesn't inherently lock the machine, too.....



[ Reply to This | # ]
Youpi Key
Authored by: robmorton on Nov 20, '02 01:41:23PM

You can do this type of stuff with Youpi key as well. It is free and seems to not cause issues with various application and upgrades.
http://perso.club-internet.fr/phupe/english/YKIndex.html



[ Reply to This | # ]
Youpi Key
Authored by: conrad on Nov 20, '02 10:36:25PM

Since submitting this hint, I\'ve actually switched to using YoupiKey for the above. I\'ve found it can handle more keyboard combinations than FruitMenu. Thanks for all the feedback on this hint.



[ Reply to This | # ]
easier way to lock screen
Authored by: Kriek on Nov 20, '02 01:51:44PM

another nice feature is to 'show status in menubar' of the keychain access, and lock screen from there.
1. Open keychain
2. under view menu, check 'show status in menubar'
3. This puts a small lock nxt in your menubar, if you click on it, the first option in the contextual menu is 'lock screen'

simple



[ Reply to This | # ]
Why not use the Mouse
Authored by: hap on Nov 21, '02 02:49:04AM

I'm a keyboard guy by nature but couldn't you get what you want using the screen effects control panel? You can set "hot corners" so tha when the mouse is dragged into one of them after a few seconds the screen saver will be activated and you can password protect that (also from the Screen effects control panel).

Just a thought
Hap



[ Reply to This | # ]