Duckduckgo as awesome default

2013.06.22 by Matthias Kirschner in #fsfe #hacking #privacy

Hugo made me curious about duckduckgo a long time ago, but I did not take the time to take a deeper look into its funtionality. Finally in the last weeks, I tested duckduckgo and liked it. Especially the concept of !bangs, as I used search words in galeon, konqueror, or chromium before. I like the fact that those bangs are also available on computers I did not configure before, so you can also do effective searches at your friend's computers (if they do not use other keyboard layouts). There are for example !w, !leo, !define, !dbugs, !imdb and many many more. Beside I also like the provided goodies like "distance Berlin to Munich". So after I was satisfied using it I started implementing it deeper in my setup.

First I made duckduckgo the default in iceweasel/Firefox by editing the config after entering about:config in the location field. There I changed the value for keyword.URL to https://duckduckgo.com/html/?q=. In Chromium you can just change the default search engine in the settings.

So when I read something and want to search I could 1) go to the browser window, 2) type Ctrl + L, 3) type my search like !w Free Software in the location bar, 4) wait until the page with the result is loaded. But I wanted to be able to run a search the awesome window manager's default run command. I remembered that some years ago I was using surfraw to support me with searching, which I now abuse for this aliasing. This following file is called ddb, located in /usr/local/bin:

[bash]
#!/bin/sh
surfraw duckduckgo \$@
[/bash]

Now I can 1) open the run command by hitting Meta + r, than 2) type e.g. ddg !w Free Software Foundation Europe 3) go to my browser window and the search result is already loaded in a new tab.

I will play around a bit more. Would be nice to have something like the !tweet function, Hugo wrote about, also for status.net or diaspora messages.

Update: Werner Koch author of GnuPG suggested to add an "html" in the duckduckgo URL. This way you do not need Javascript. Surfraw is doing this by default, too.