Lock screen or sleep from Quicksilver

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:

sleep.sh

#!/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:

lockscreen.scpt

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.

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s