I’ve really enjoyed the switch from LaunchBar to Alfred, right around the time that version 2 was released, bar one little niggle that I’ve encountered. I’ve dived head first into the Workflows Forum discovering neat and interesting ways of interacting with apps on my local Mac and even my Mac mini media server at home. One of the features that I haven’t used extensively, that little niggle, is Alfred’s File Selection.

Alfred’s File Selection is comparable to LaunchBar’s Instant Send, which I used avidly, and enables you to directly modify files by selecting them anywhere in the Finder and double tapping on one of the Mac’s Modifier keys; I had it set up to use a double tap of the Command key. The downside of Alfred’s File Selection is that it’s only accessable using a standard keyboard shortcut rather than, in my opinion, the more accessable double Command tap.

Wanting to emulate LaunchBar’s function, I set about trying to enable this functionality using my favourite keyboard hacking application, KeyRemap4Macbook (not just for Macbooks). This took a bit of time on my pBrt as I was trying to get through the documentation which is a bit over the place. Once I worked my way though the Examples & Basic Syntax documents, as well as trawling through the samples.xml file to find any mention of DoublePressModifier, a function which enables exactly what I’m after. I finally came up with the solution!

Just paste the following bit of code into your private.xml file, click the ReloadXML button, and select “Double Command to Alfred File Selection”.


Double Command to Alfred File Selection (+ Home to beginning of line) private.DoubleCommand --DoublePressModifier-- KeyCode::COMMAND_L, KeyCode::COMMAND_L, KeyCode::A, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L

This remap will still enable the ⌘ (Command) key to act as it normalLy would but when double tapped, KeyRemap4MacBook will send ^+⌥+A (Control + Option + A). Your private.xml file can be located in the Misc & Uninstall section of KeyRemap4MacBook

If you’d like to modify this to use a different Modifier key, simply change all instances COMMAND_L to the desired Modifier key, or, if you have a different shortcut setup to activate File Selection, change the third KeyCode line to the currently active shortcut.

###Edit:

So thanks to twitter buddy @sayzlim who pointed out that Alfred can indeed use double taps as a way of activating functions, I now need to find another use for my KeyRemap4MacBook code. Oh well. Thanks mate :D