Quicklook from Alfred


I have recently been playing with Alfred and especially the Powerpack options that allow you to do some of the most awesome shell hacking with a GUI that I have ever seen.

However, after playing with it for a bit I started wishing that I could quicklook items as I navigated through them in Alfred, so I asked their support for guidance and quick as a flash I got the following answer from Anna:

Quicklook support is not directly in Alfred. With the latest 0.9 release, however, provided you can find a Terminal command that would let you quicklook a file, you could then set it as an additional action in the action list.

So I was slightly disappointed but not deterred — this is after all an App that is so young, the developer has only just gone full time on it (congrats!). I have come to a simulation of what I originally wanted to do and it is close enough to my original idea to be worth sharing — so here is my howto for it. Note that you will need the Powerpack to be able to do this, so if you have installed Alfred via the AppStore, consider upgrading, and supporting a British independent developer in the process (note you must read the instructions on the purchase page if you originally got your copy from the App store).

Howto

If you are using v0.9.9 of Alfred (or later) then you can simply download the Quicklook.alfredextension file from this site and drag and drop it into the Dropzone of the Extensions tab (Open Alfred Preferences, click ‘Extensions’ in the top toolbar and if necessary, click the little home application at the bottom right of the list pane on the left of the window).

If you are on a previous version (at the time of writing, this includes the main release), or just want to recreate the extension from scratch, open the Alfred Preferences and choose the Features tab. Click on Terminal/Shell under System in the left hand sidebar, then click the + button at the bottom of the Shortcuts list to add a new shortcut, fill in the details as follows:

  • Title: Quicklook
  • Description: Open Apple’s Quicklook window on the item
  • Keyword: ql (i.e. that is the two letters Quebec Lima)
  • Command: qlmanage -p {query}*
  • Backslash escape Quotes: Yes
  • Backslash escape Spaces: Yes
  • Optional: if you want to memorialise that you got this hint from me, drag the logo from techpragmatist.co.uk on to the icon dropzone
  • click Save, then check both Silent and Action

There are so many ways to use it that I won’t even try and list them all, here are just a couple of the most common ones I use:

  • use alfred to navigate to a place in your folder structure (e.g. ~/Documents) then use the down/up arrow keys to find the document you want to quicklook, press the CTRL key and then scroll up once to Quicklook. Pressing enter now will open quicklook on your selected document. If you want to take more actions on the same file then the default key is OPT-CMD-/ to open Alfred with the previous item selected.
  • open Alfred, type ql ~/Downloads/ and hit enter, then press the thumbnail button (the one on the right that looks like a 2x2 grid) in the quicklook window to see thumbnails of what you have in your downloads folder

Any workaround has a few caveats, even a good one:

  • The quicklook window will always have the DEBUG text in square brackets before the filename - sorry, it is a developer trick not meant for production use
  • You cannot close the quicklook window by pressing the space bar, nor can you close it using CMD-W — as far as I can tell, clicking on the X in the top left of the window with the mouse is the only way to close it.

If you find this useful, please comment on the original request and ask for quicklook to be implemented natively in Alfred.