Lion offers a fast user switching command if you go to users > login items > enable fast user switching > full name

Essentially you can lock your computer by clicking on your name in the toolbar and locking clicking "login screen"

I was wondering if it was possible to run a script to kill a certain process (just 1) when you went to the login screen. I found this file but I'm not sure its the right one.


If I write a simple shell script like this to it, can I kill the file?
> sudo defaults write /Library/Preferences/com.apple.loginwindow.plist.lockfile ps -ax | grep Application | awk '{system ( "kill "$1 )}'

Perhaps I'm not writing a shell script the right way to a com.apple file?

I also found a LogoutHook ran when the computers logouts on

sudo defaults write com.apple.loginwindow Logouthook /usr/bin/script but is this initiated at switch user time?

thanks for your help,