Alfred Workflow - Search Link21 May 2021
For anyone using a Mac for an extended period of time and looking for ways to do things better, the chances are that you will have come across the name Brett Terpstra. Brett is a creative guy who shares a lot of the things he makes that help make life on the Mac that bit easier. Something I am totally on board with, taking a similar approach myself across the platforms I deal with. A few days ago Brett updated one of his tools, and one that I use regularly. A tool called Search Link. I figured this might be a good time to publish a small Alfred workflow I have for working with Search Link.
What is Search Link?
Search Link is a way to quickly lookup Markdown links directly from where you are typing. It exists as a small set of Mac services/quick actions, that allow you to enter and process a search term along with some parameters you can specify and even customise. It is a big time saver for anyone working with links and Markdown.
Here is the introduction from the Search Link home page on Brett’s site, which is where you can download the latest version and learn how to use it.
SearchLink is a System Service for macOS which handles searching multiple sources and automatically generating Markdown links for text.
It works in a few ways:
⇨ Run a quick search on a single selection, and have the selection replaced with the resulting url (and optional title) as a Markdown inline link, a Markdown reference, or just a plain url.
⇨ Run a single search and have the results put on your clipboard, perfect for using from scripts and launchers (e.g. LaunchBar or Alfred).
⇨ The “bracket” format, which allows you to just write, marking things to link as you go. When you’re done, you can run it on the full document and — if your queries were good — have your links generated automatically without ever opening a browser.
I’ve called my workflow for working with Search Link “Slink” (I was oh so tempted to call it ‘Slinky’), and it is fairly straight forward with two distinct flows within it.
The following description is included in the Workflow.
Slink is a helper workflow for Brett Terpstra’s
Search Linkservices, a small toolset to help you quickly generate Markdown links.
You can download Search Link from its project page on Brett’s web site.
This helper workflow has two flows that can be triggered:
“sl” followed by your Search Link string will trigger the Search Link service against your search string, and copy the resulting Markdown link to the clipboard.
Holding down the CMD key while executing this search will copy the resulting URL to the clipboard.
Holding down the CTRL key while executing this search will open the resulting link in your default web browser.
CONFIGURE SEARCH LINK (slc)
“slc” will open the Search Link configuration file in the editor of your choice, as specified by the
As an example of what you can put in the
editorpath variable, I use
/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl, which is the path to SublimeText 3 on my Mac. Simply put in the path to your preferred editor and Slink will attempt to pass the configuration file to it to be opened.
I’ve been using Search Link for a few years with Alfred. I created the configuration flow first at the time I started changing the settings. I was experimenting over the course of several days, and so being able to trigger opening the configuration file quickly from Alfred was rather helpful. Shortly thereafter I took the AppleScript Brett had shared for Launchbar (another Mac launcher utility similar to Alfred), and repurposed it to use with Alfred.
Recently I’ve been tidying up my Alfred workflows for sharing. For this one I expanded some of the search options, consolidated the two flows into a single shareable workflow and cleaned things up into a much better state.
This is a relatively straight forward workflow with only a few options, but I find it quite useful. I only use Search Link from Alfred occasionally as I have a keyboard shortcut linked to the Search Link service, but I will absolutely admit to getting good use out of the very simple open the configuration file in my editor flow. Every few months I’ll end up wanting to tweak something in the configuration file, and accessing it via Alfred is so much quicker than hunting it down manually each time.
If you are a causal user of Search Link, I expect that you’ll find this workflow more useful. Shortcut keys that are not used frequently are forgotten easily, but “sl” followed by a search term in Alfred, well that I think is a bit more sticky.
Whatever the case, I hope that this Alfred workflow helps you get the best out of Search Link.