Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

1 total

Switch to the login window from the command line

# cf. http://www.mactipper.com/2008/07/securely-lock-your-mac-system.html,
# http://www.macosxhints.com/article.php?story=20040724203315798 and
# http://www.apple.com/downloads/macosx/automator/lockdesktop.html

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

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID username


alias lo='/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'

# <ctrl> + l
help bind
bind -P | grep -i c-l
bind -x '"\C-l"':'/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'

# <esc> + l
#bind -x '"\M-l"':'/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'
bind -x '"\el"':'/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'


#---------------------------------------------


open -a 'Keychain Access'

# go to  Keychain Access > Preferences ... > General > activate "Show Status in Menu Bar" 
# now you can use "Lock Screen" via the Keychain Access menu bar item
1 total