I recently got a new laptop, and I’ve been transferring over all of my settings. I often use Quicksilver to trigger a screen lock or put my laptop to sleep. Here’s how I do it.
I use a shell script to put my machine to sleep:
#!/bin/bash pmset sleepnow
In order to be able to trigger the shell script from Quicksilver, you’ll need the “Terminal Plugin” installed.
I use an AppleScript script to lock my screen:
tell application "System Events" set ss to screen saver "Flurry" start ss end tell
I use the QuickSilver “Add to Catalog” action to add sleep.sh and lockscreen.scpt to the catalog. That action isn’t enabled by default, to enable it, you need to open QuickSilver preferences, click “General”, choose “Actions”, search for “Add to Catalog”, and enable it.
By default, the “Open” action has a higher precedence than the “Run” action for shell scripts. You can change the precedence order of actions by dragging, I dragged the “Run […]” action (Run a Shell Script [with optional arguments]) above the “Open” action.