Command line application to lock Mac OS X screen
Use XCode or the following command from the same lockscreen subdirectory:
clang -framework Foundation main.m -o lockscreen
Copy executable to an easy to access directory (ie "~")
Open a new automater document, and choose "Service".
Choose Service recieves "no input" and in "any application"
Drag and drop "Run Shell Script" to the workflow, and choose "/bin/bash" for the Shell.
In the text box put the path to the lockscreen executable file (ie. "~/lockscreen")
Save and name the service.
Open System Preferences -> Keyboard -> Shortcuts
Under Services -> General select your new service and assign a keyboard shortcut to it.
Application shortcuts will override these shortcuts, so choose one that is unlikely to be used.