summaryrefslogtreecommitdiffstats
path: root/articles/auto-suggestions-for-duckduckgo-in-conkeror.org
blob: ef3527325e8c8573d6fdead8d371c0aa09c6ecd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#+TITLE:
#+STARTUP: showall

* Auto-suggestions for DuckDuckGo in Conkeror        :conkeror:config:
  :PROPERTIES:
  :PUBDATE:  <2014-06-03 Tue 22:08>
  :END:

  Recently [[https://duckduckgo.com][DuckDuckGo]] gave its UI a big overhaul. One of the new parts
  of the UI is the auto-suggestions, which are pretty cool, especially
  when working with ~!bang~ syntax. I want that in my conkeror webjump!
  So I started looking...

  Turns out that [[http://conkeror.org][Conkeror]] can work with [[https://en.wikipedia.org/wiki/OpenSearch][OpenSearch]] descriptions to
  create webjumps and actually already has a DuckDuckGo OpenSearch XML
  file. However, DuckDuckGo has a newer version of that file.

  So, for starters you should download the proper XML [[https://duckduckgo.com/opensearch.xml][file]]. After
  this, you can replace the
  ~/usr/share/conkeror/search-engines/duckduckgo.xml~ file[fn:1] with
  the newly downloaded one and you'd be done, ready to use the new
  auto-suggest functionality[fn:2].

  If, however, you don't like overwriting your package's files because
  they may get overwritten again in the future[fn:3] or you really
  don't think it's proper, you can also create a custom webjump that
  does the same thing, which is what I did.

  In case you are following my lead, first we'd need to put the
  downloaded XML file somewhere. I suggest
  =~/.conkerorrc/search-engines= because that way everything in your
  configuration stays nice and contained, although you might want to
  put it in your
  =~/.conkeror.mozdev.org/conkeror/CODE.PROFILE/search-engines=, where
  ~CODE~ is an eight-character alphanumeric sequence (as far as I can
  tell) and ~PROFILE~ is the name of the profile you use[fn:4], because
  that should already be included in your =opensearch_load_paths=.

  If you put the XML in your ~.conkerorrc~ you'll need to add that
  directory to your =opensearch_load_paths=, so put something like the
  following in your ~init.js~, or whichever filename you use for your
  conkeror init:

  #+BEGIN_SRC javascript
    opensearch_load_paths.push(make_file("~/.conkerorrc/search-engines"));
  #+END_SRC

  After Conkeror knows where to find your custom search engine
  specifications you can create a webjump for it:

  #+BEGIN_SRC javascript
    define_opensearch_webjump("ddg", "ddg.xml");
  #+END_SRC

  Once you evaluate these lines or restart your Conkeror, you should
  have a ~ddg~ webjump with auto-suggestion. Yay!

* Footnotes

[fn:1] I have Conkeror installed in ~/usr~, so if you have it installed
  somewhere else your path will be different.

[fn:2] You might have to restart Conkeror first, I didn't test it
  without restarting.

[fn:3] This can of course happen when, for example, your package
  manager updates your Conkeror installation.

[fn:4] The default profile is named (appropriately) ~default~.