Skip to content

Instantly share code, notes, and snippets.

@bryanl
Created July 6, 2011 16:02
Show Gist options
  • Save bryanl/1067609 to your computer and use it in GitHub Desktop.
Save bryanl/1067609 to your computer and use it in GitHub Desktop.
applescript to lock screen on mac
do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"
@gjoseph
Copy link

gjoseph commented Sep 14, 2011

Don't you have a terminal opened more often than the AppleScript editor ? I have this in my ~/.profile

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

@bryanl
Copy link
Author

bryanl commented Sep 14, 2011

Actually, I call it from Launchbar. That is why I needed an applescript.

@gjoseph
Copy link

gjoseph commented Sep 14, 2011

Arrhh, yeah, I guess I should have read your blog post completely before reacting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment