Harness the Power of DuckDuckGo with Actions

DuckDuckGo

In my previous article, I covered how you could use Actions to streamline Google searches. I however, prefer using DuckDuckGo and therefore was thrilled to see it officially supported in OS X Yosemite. That, and a recent new addition to Actions – the Keyboard – open up new possibilities that are worth looking into.

For those unfamiliar with DuckDuckGo, it’s a community driven search engine with a strong focus on privacy and efficiency. Even if you feel DuckDuckGo isn’t for you, it’s still worth reading this article since you may glean a few ideas of how to use the Keyboard in Flows.

DuckDuckGo and Google share many of the same features and functionality, albeit with subtle but important differences. In order to make this more apparent, I’ll recreate some of the same Flows that I covered in the previous article. You may also recall from that article that Safari required a additional steps in order to work properly (it would keep focus on the address bar, rendering other actions of little use). Fortunately however, using the entire DuckDuckGo URL in the address bar resolves this and mitigates the need for those steps.

The Keyboard Power-Up

The inclusion of the Keyboard Power-up in Actions opens up a realm of new possibilities. Not only does it allow you to type as you’d expect, but it also features a special “Trackpad” with which you can move the cursor or select some text.

This of course mitigates the need to select some text before triggering an action (a limitation of the Flows in the previous article). While not every Flow requires use of the keyboard, it’s definitely an excellent tool to have at your disposal.

To summon the keyboard, simply add a snippet action to your Flow with :keyboard. When you’ve finished typing or selecting some text, hide the keyboard (bottom right corner) and the Flow will continue.

Search Flows

DuckDuckGo supports myriad search options, ranging from simple to the more complex. Just as before, we’ll start with the simple search and work our way up from there.

Normal Search

This is the most basic of searches you can perform in DuckDuckGo. Create a Flow with the following actions:

  • A snippet action with :keyboard. This will bring up the keyboard allowing you to select some text. You can omit this step if you don’t want to use the keyboard;
  • A shortcut action with cmd+C targeting the current application;
  • Another shortcut action with cmd+T, this time targeting the browser of your choice (I only tested Safari though…). This will open a new tab ready to receive your search;
  • Add a snippet action with https://duckduckgo.com/?q=(:). Remember that adding (:) will place the text cursor in that position. This simply ensures that the search term will be added in the correct location;
  • Add another shortcut with cmd+V to paste the previously copied text;
  • A shortcut action with enter;

Exact Match Search

By default, DuckDuckGo will perform a search using every term joined by a boolean AND (foo AND bar). There are times however when you’ll need an exact match for a specific term or phrase. This is accomplished by enclosing the search term in parenthesis. For example, searching for Google and Actions will produce very different results when you search “Google and Actions”. Give a try and you’ll see what I mean.

Just as before, create a new Flow with:

  • A snippet action with :keyboard. Just as before, you can omit this if you prefer o select text with you mouse or physical keyboard;
  • A shortcut action with cmd+C, targeting the Current Application;
  • A shortcut with cmd+T targeting the browser of your choice;
  • A snippet action with https://duckduckgo.com/?q="(:);
  • A shortcut with cmd+V;
  • A shortcut with a right arrow. This will de-select the text and place the cursor at the end (just playing it safe);
  • Another snippet action with ";
  • A final shortcut with enter.

In Title & In Body

It’s also possible to search for a term in a page’s Title (search terms will be present in the title of the page) or Body (search terms will be present in the body of the page).  Both Flows are identical, with one minor exception.

  • A snippet action with :keyboard;
  • A shortcut action with cmd+C, targeting the Current Application;
  • A shortcut with cmd+T targeting the browser of your choice;
  • A snippet action with either https://duckduckgo.com/?q=t: (:) (short for title) or https://duckduckgo.com/?q=b: (:) (short for body);
  • A shortcut with cmd+V;
  • A shortcut with enter;

File Types

Just like Google, DuckDuckGo can filter the query results to specific filetypes. For example, simply prefix or append f:pdf to search for PDFs containing the search term, here’s how:

  • A snippet action with :keyboard;
  • A shortcut action with cmd+C, targeting the Current Application;
  • A shortcut with cmd+T targeting the browser of your choice;
  • A snippet action with https://duckduckgo.com/?q=f:pdf (:);
  • A shortcut with cmd+V;
  • A shortcut with enter;

Tip: Remember that while in edit mode, you can tap and hold with two fingers to duplicate the action and create it for as many file types as you want.

Instant Answers

DuckDuckGo features something they dub as Instant Answers (they appear above every other result). Often enough, you can tailor your search to show quick answers by simply prefixing/appending certain keywords. Add map, images or news to quickly get a map, images or news pertaining to your search term.

Create a simple flow as the one below and then duplicate it and adjust accordingly to suit your needs:

  • A snippet action with :keyboard;
  • A shortcut action with cmd+C, targeting the Current Application;
  • A shortcut with cmd+T targeting the browser of your choice;
  • A snippet action with https://duckduckgo.com/?q=(:) keyword. Remember to experiment with keywords. They can be as simple as images, maps, news or as crazy as calories or rhymes;
  • A shortcut with cmd+V;
  • A shortcut with enter;

!Bang Search

!Bang Searches are another novel feature introduced by DuckDuckGo. By simply prefixing your search with a bang (!) followed by a keyword, DuckDuckGo will an extensive and ever growing list of sites. As a quick example, !a will search Amazon, !github will search GitHub and !appstore will search the AppStore. Now that you’re starting to see the sheer power of this small little feature, let’s create a Flow to take advantage of it:

  • A snippet action with :keyboard;
  • A shortcut action with cmd+C, targeting the Current Application;
  • A shortcut with cmd+T targeting the browser of your choice;
  • A snippet action with https://duckduckgo.com/?q=!a (:);
  • A shortcut with cmd+V;
  • A shortcut with enter;

Now duplicate and create as many !Bang Searches as you’d like and organize them in a subset. You’ll soon be searching dozens of sites with a simple tap.

Trigger Results

Like Google, DuckDuckGo has excellent support for keyboard shortcuts , allowing you to easily select one of the search results on screen. Once you’ve performed a search, simply press the down arrow to highlight a search result and then press enter to open it.

Armed with this knowledge you should have no problems creating a couple of Flows to trigger the desired result. For the first one, create a Flow with 2 shortcuts”: a down arrow and an enter. To tigger the second result, simply add another down arrow, and three arrows for the third…you get the idea.

First Exact Match

When it comes to triggering results, DuckDuckGo has a neat trick up its sleeve. Prepend ** to your search and the very first result will be loaded immediately. Combine this in a Flow** to get lightning fast results:

  • A snippet action with :keyboard;
  • A shortcut action with cmd+C, targeting the Current Application;
  • A shortcut with cmd+T targeting the browser of your choice;
  • A snippet action with https://duckduckgo.com/?q=\(:);
  • A shortcut with cmd+V;
  • Finally a shortcut with enter.

Utility Flows

Now that you’ve mastered search, let’s delve into a few utility Flows with DuckDuckGo.

Current Time & Weather

A couple of useful examples of Instant Answers–I touched upon these earlier in this article–are weather and time. To take advantage of this, create a flow with:

  • A shortcut action with cmd+T targeting the browser of your choice;
  • A snippet action with either https://duckduckgo.com/?q=time in New York or https://duckduckgo.com/?q=weather in New York;
  • A shortcut with enter.

Now duplicate this action and add as many locations as you desire. Don’t forget to keep things organized with subset.

While this may be great, what about those times when you need to lookup a less frequent location? The answer is simple, use the keyboard:

  • A shortcut action with cmd+T targeting the browser of your choice;
  • A snippet action with either https://duckduckgo.com/?q=time in (:) or https://duckduckgo.com/?q=weather in (:);
  • A snippet with :keyboard;
  • A shortcut with enter. If you find that you prefer to press enter on the keyboard, then simply omit this step.

Convert Currency

If you’re like me and often purchase goods oversees, it can help to know the value in your local currency. I’ve created a few Flows for this:

  • A shortcut with cmd+T targeting your browser;
  • A snippet with https://duckduckgo.com/?q=euro to usd will show you how the current value of the Euro compares to US Dollar;
  • A shortcut with enter.

If however you’d like to know the exact conversion of a specific value, then create a Flow with these actions:

  • Shortcut with cmd+T targeting your browser;
  • A snippet with https://duckduckgo.com/?q=(:);
  • A snippet with :keyboard;
  • Shortcut with right arrow;
  • Another snippet with euro to usd (Notice the preceding space);
  • A final shortcut with enter.

General Conversions

You can create as many Flows as you need to perform general conversions. Duplicate the Flow to convert currency, but this time replace the final snippet with whatever you’d like to convert. meters to feet, kilos to pounds, minutes to seconds. DuckDuckGo uses Wolfram Alpha as a source for most these conversion, so anything Wolfram can handle should work just fine.

In Conclusion

If anything was clear from my previous article, it was that Actions is a truly versatile tool. Now with the inclusion of the Keyboard, that versatility soars to new heights and I for one look forward to seeing where it takes you.

Pedro Lobo

A System Administrator by day and freelance technology writer by night. I put words together to express my opinionated views on software, hardware or anything that strikes my fancy. Said words can be found in a variety of places, among which my blog. When not spending time with my family and taking photographs, I can be found on app.net or Twitter