Integrating Alfred and Kaleidoscope

  • Florian 
  • 10 min read

As a long-time Mac user, I’ve seen lots of productivity tools come and go, and I’ve used a fair amount of them through the years. Who still remembers Quicksilver (β)? It was pretty awesome at the time… Other notable mentions for me personally are Butler by my dear pal Peter Maurer and LaunchBar. There are also still new kids on the block, like RayCast.

However, the one I keep coming back to and that is running 24/7 on my Mac is Alfred. I particularly like its combination of easy discoverability of the more mainstream features and the sheer power it hides by default, but offers when you need it.

What can Alfred do for you?

The Alfred window, minimalistic version

I could fill pages describing the features of Alfred, but there is the original source for that, if you are curious. Today I want to focus on two features that are crucial to how I personally use a Mac: file search and the clipboard history.

When running in the background, Alfred does a few things on its own, like index files and watch your clipboard. But as a user, you interact with Alfred by invoking its window. I have set mine to a rather minimalistic look.

Alfred Hotkey preference setting

As I hate memorizing keyboard shortcuts, I have set Alfred preferences to have it show up by double-tapping the control (⌃) key. This enables muscle memory to work on my behalf.

Clipboard History

To my delight, there is a very recent blog article over at alfredapp.com on exactly that topic, even with the perfect title. Clipboard History: The Feature You Never Knew You Needed.

The basic principle is super simple. The Alfred clipboard history just keeps the last x items you copied to the clipboard (typically using ⌘C), from whatever source. Nowadays, with Universal Clipboard and multiple Apple devices, this even includes your iPhone and iPad—amazing in itself.

Where does that stuff go, and how do I retrieve it?

Whatever you copy to the clipboard gets stored by Alfred. Of course, there are lots of options to customize that behavior, like ignoring certain types of data or certain source apps (like password managers).

If you want to access that stored data and use it, simply invoke the direct keyboard shortcut (I have set mine to ⌥⌘C, but can never remember it), or double-tap the control key (⌃⌃) and type the letter c, which offers the Clipboard Viewer as a first search result. Hit enter to confirm.

Bringing up the Clipboard Viewer in Alfred

Now you get to see a list of stuff stored and can immediately access the last 10 items by pressing enter or ⌘1 to ⌘9. Quite convenient in itself, but for me, the real power comes from changing how you work as a result.

Consider the article you are reading right now. For the first paragraph, I needed to gather a few URLs of those products. Instead of going back and forth between Ulysses (the app used to write this article) and Safari (to retrieve the page URLs), I can instead collect all URLs in one go and just put them onto the clipboard by finding the product pages and hitting ⌘C. When I’m done, I head back to Ulysses and paste them in where I need them by making use of the Alfred Clipboard History. Saves me quite a few roundtrips and makes working smoother.

And what about Kaleidoscope?

This wouldn’t be the Kaleidoscope Blog without offering a good integration with Kaleidoscope.

Let’s assume you have found two pieces of text on the web that you want to compare. For the sake of this example, let’s compare the “About Apple” paragraph of text from two Apple press releases. The first one is the iPhone 7 announcement from September 7, 2016. And compare that with iPhone 12 from October 13, 2020.

I’ll scroll down towards the end of the page to find the paragraph starting with “Apple revolutionized”. I select the paragraph with a triple-click and hit ⌘C. Then I repeat the same on the other article.

Bring up the Compare in Kaleidoscope workflow action

The following trick assumes you have installed an extension to Alfred, called a workflow. See further down for a link to download that workflow.

Now I bring up the Alfred window (⌃⌃), then start to type “ksclip”, but depending on your search index “ksc” should be sufficient.

Complete the command by pressing the return key (↵). And voila, Kaleidoscope opens and shows us the comparison of those two paragraphs. Apple gained a software platform and a few employees over the last 4 years.

Kaleidoscope comparing two paragraphs of text that we previously copied to the clipboard.

To summarize: Alfred can be extended using workflows, which is a very powerful way of adding entirely new features to Alfred. Here, we are combining the clipboard history feature of Kaleidoscope with the power of the ksdiff command-line tool built into Kaleidoscope to compare the last two pieces of text that were copied to the clipboard. This of course works with all apps that handle text…

File Search

Simple File Search

Likely the primary use case for a tool like Alfred or any of the others mentioned above is quickly browsing files. The Mac is very approachable with the Finder and the Open dialog, but both can be slow and cumbersome to use with bigger file systems. And while Spotlight is here to help in those cases, it is still fairly limited. More advanced users will likely look for better options.

As you would expect, you can bring up the Alfred window, start typing, and Alfred will show you files it finds that match your search. Once you have found what you were looking for, you can hit return (↵) to open that file or the right arrow key (→) to show more commands.

Compare multiple files with Kaleidoscope

Similar to the Clipboard History for all kinds of content, Alfred has a way to keep multiple files around, this is called the file buffer. Again, there are lots of options to configure in the preferences.

Let’s put this to use, again using our Kaleidoscope workflow, to compare the files in the file buffer really quickly.

I remember there were multiple hover button classes in the Kaleidoscope project, and I even added one, but I can no longer exactly remember what each one is for. So much for good class naming.

Let’s bring up Alfred and start searching. Class names in Kaleidoscope have a prefix of “KS”, plus I know I want something with “hover”, so let’s just search for “KS*hover”.

Alfred is quick in finding the 4 candidates, 2 headers and 2 implementation files. Here I am interested in the headers.

While located on the first result, I type ⌥⬆. This adds that file to the file buffer. Its icon shows up in the top area of the Alfred window, and the file gets a small circled arrow up annotation.

Now I hit ⬇ two times, and then again ⌥⬆ to add the second .h file to the buffer.

Now that I have my buffer prepared, I want to act on it. For this, I type ⌥➡. Now I see the actions offered to me, including custom workflows I added.

Now I can either scroll down or immediately type ⌘9 to executer “Compare in Kaleidoscope”. This will open Kaleidoscope and tell it to compare all items in the file buffer. This is not limited to 2 files…

Two Objective-C header files compared via the Alfred workflow for Kaleidoscope.

Subtle variation

If you prefer using keyboard shortcuts, there’s an alternative workflow action for you: Repeat the steps above to get stuff into the file buffer. Once you have gathered all files, just hit ⌃⌥K. This will immediately open the buffered files in Kaleidoscope. This is obviously even faster to use but requires you to memorize the keyboard shortcut.

Note that the file buffer tricks work with all file types that Kaleidoscope supports. It can be particularly great to compare photos with similar or equal file names, and which may or may not be equal.

The clipboard history on the other hand currently only supports text content.

Get the workflow

Hoping you like what you saw, here’s the Kaleidoscope Alfred Integration workflow to download. Uncompress the downloaded .zip archive and double-click the resulting file. Of course, you need to have Alfred (version 4.x) installed for this to work.


Install ksdiff

Also, if you haven’t done so, you need to install the Kaleidoscope command-line tool called ksdiff. If you’re not using it, either directly or via some other integration, you’re probably missing out on the real power of Kaleidoscope.

Get the command-line tool from Kaleidoscope > Integration…

Enjoy, and please contact us with feedback you may have. We love reading from our users!

Summary

Both Alfred and Kaleidoscope are rather powerful tools when used alone. But what makes great apps shine is when you combine them with one another and increase your productivity.

Today I demonstrated two of my favorite features of Alfred and combined them with a small (workflow) extension for Alfred, to send content into Kaleidoscope. This adds two more ways of quickly showing differences of arbitrary text content and files on the file system.

The clipboard history is a great way to help streamline your workflow: first copy two pieces of text to the clipboard (where Alfred remembers both of them), then tell Alfred to compare that text using Kaleidoscope. This is much quicker than going back and forth between apps.

The file buffer does a similar thing with files: you first gather a few files you want to combine, without ever leaving Alfred. Then, using a single command, you compare all of those files using the power of Kaleidoscope.

If you know useful tricks not mentioned here, let us know. Or do you miss integration with other tools that are indispensable for you? We’d love to hear…

2 thoughts on “Integrating Alfred and Kaleidoscope”

  1. Great article! I like both Kaleidoscope and Alfred and I find I haven’t used the clipboard history yet. Very informative and useful. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *