Sunday, November 14, 2010

Productivity Boosting Shell Script: Search Gmail Without Viewing Inbox

I'll often go into Gmail to accomplish a specific task and get distracted by shit that doesn't really matter. To solve the problem of entering Gmail to send somebody e-mail, only to be distracted endlessly by new mail, I created a micro-business experiment called Email Without The Inbox. To solve the problem of entering Gmail to search for something, only to be distracted endlessly by new mail, I created a simple bash script for OS X.

Here it is, in its entirety:

# search Gmail THIS WAY, not by going to the Inbox
search_gmail() {
open "http://mail.google.com/mail/#search/$*"
}

Usage:

search_gmail whatever

This takes you directly to your search results from the command line, and allows you to skip entirely the whole distracting experience that is your inbox. Note that it only works for one-word search terms, and would need some minor tweaks (namely URL encoding) to support fuller searches. (I'd put the gist on GitHub and encourage you to fork it, but GitHub appears to be down at the moment.)