The marvelous Alfred.app is one of my favorite tools for Mac OS X. At its core, Alfred is a simple and effective app launcher. When used to its full potential, it does much more. Among many other things, Alfred lets you find and manage files, control music playback, manage and search clipboard history, and search the web. It exposes that incredibly rich set of features through a fantastic, keyboard-friendly user interface.
Alfred is also extensible, allowing the user to define their own commands and search filters. The latter is especially significant: Alfred leverages the Spotlight search infrastructure under the hood, but provides functionality on top that makes it easy for the user to conduct powerful, targeted searches and perform useful actions on the search result items. According to Alfred’s built-in usage calculator, I use the tool an average of 90 times per day. It’s easily one of the most heavily-used tools in my arsenal.
The Alfred team is currently developing an impressive new version version of the application that introduces a number of new features. They released a private beta of Alfred v2 over the weekend, making it available to Mega Supporters—users who purchased a lifetime license. As a Mega Supporter, I am among the beta testers.
The most exciting feature in v2 is the new “workflow” system, which greatly enhances Alfred’s extensibility. It allows the user to compose complex chains of custom triggers, filters, actions, and outputs to create much more powerful third-party extensions. It also adds an awesome new “scripting filter” mechanism that lets the user create scripts that programmatically generate custom query results.
I’ve already built several of my own custom workflows (using a combination of Python, shell scripting, and AppleScript) that perform useful tasks. I’m making them available here for the benefit of other Alfred v2 users.
The scripting filter that I made for this workflow (written in Python) allows you to search for repositories on GitHub. It uses the GitHub REST API to display results directly in Alfred as you are typing. Select a repository from the results and hit enter to visit the repository’s GitHub page in your default web browser. If you hold the “alt” key when you hit enter, the workflow will instead open the official GitHub app for Mac OS X and clone the desired repository.
This workflow can be used to perform Markdown processing on the selected text, clipboard content, or a file. It will put the HTML output into the system clipboard so that you can paste it. The workflow also has a file filter that makes it easy to search for Markdown files and optionally open them in Marked.app. I embedded the MIT-licensed Markdown 2 Python library in this workflow so that it can handle Markdown processing without requiring the user to install any additional software.
This workflow includes a file filter that will allow you to search for Evernote notes by title. When you hit enter, the Evernote desktop app will display the selected note. The workflow also includes a fallback search that uses AppleScript to pass the user’s search query directly into the Evernote app’s built-in search box.
This workflow allows the user to control Philips Hue lightbulbs. It defines a “hue” keyword command that lets you adjust brightness by providing a numerical value between 0 and 255. You can also type “hue on” and “hue off” to turn the lights on and off. In order to use this workflow, you will have to modify several variables at the top of the script: the local network IP address of your Hue base station and an app registration hash. Refer here for details about app registration and Hue hacking.
This workflow will use AppleScript to forcibly open a new Chrome window on the current space. It avoids doing annoying things like giving focus to an existing Chrome window or jumping to another space.