User Tools

Site Tools


blog:2012:01:25-create_your_own_firefox_search_plugins

Create your own Firefox Search Plugins

You didn't found a search plugin for a service you use often and are tired of first going to the service search form or typing your search terms directly in the URL? Here's how to add your own custom search plugins in two minutes.

How It Works

In Firefox/Iceweasel, you can do only limited searches using the URL bar (I miss the combined URL/search bar and intelligent bookmarks from Epiphany). You need to use a different search box (Ctrl-K). This search box can select a different search engine to use, by clicking on the drop-down icon or by typing Ctrl-Down/Up.

You can disable some of the default search engines by choosing “Manage Search Engines…”, but there is no easy way to add one. When you try to add one, you are directed on a Mozilla extension page suggesting you should install one of a very limited list given there.

How to Add Your Own

Have a look at /usr/lib/firefox/searchplugins (or /usr/lib/iceweasel/searchplugins, or find it yourself). This folder contains XML definitions for all preloaded search engines. Copy one that look reasonably close to the service you want to use and edit it to replace descriptions, icon, URL and parameters.

For example, here is my search plugin to translate from English to French using Google Translate, which I derived from google.xml:

translate_en_fr.xml
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Translate (En -> Fr)</ShortName>
<Description>Google Translate from English to French</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://translate.google.com/favicon.ico</Image>
<Url type="text/html" method="GET" template="http://translate.google.com/#en|fr|{searchTerms}" />
<SearchForm>http://translate.google.com/#en|fr</SearchForm>
</SearchPlugin>

Create a ~/.mozilla/firefox/YOUR_PROFILE/searchplugins/ folder, move your XML definition there and restart Firefox/Iceweasel. You are done!

Even Easier

Some nice searchable sites or services supports OpenSearch. When its the case, just go to the site and unroll your search bar menu. You should have an entry that says “Add THE_SITE”. When clicked, it creates the search plugin for you.

You can try it on this blog!

Discussion

Pype, 2012/01/26 14:18

'faudra que je regarde ça de plus près.

Sinon, tu avais déjà entendu parler de dbus-monitor ?

Cyril Soldani, 2012/01/26 15:03

Non, merci pour le tuyau ;-)

Emilio, 2012/06/30 11:01

Hi, I try to customize a Google search engine in Firefox/Win7 but I'm not able to do it, could you help me? My intent is to make a plugin that search a selected word plus a specific word, the same word every time, i've tried to add it next {searchTerms} with a + … but don't work. Thanks in advance

Emilio

Enter your comment. Wiki syntax is allowed:
 
blog/2012/01/25-create_your_own_firefox_search_plugins.txt · Last modified: 2012/01/25 10:30 by csoldani