GNOME – Customize Search Engine Buttons in GNOME Shell

gnomegnome-shellsearch

When searching in gnome-shell, there are two buttons towards the bottom of the screen which can be used to search with Wikipedia and Google.

Is there any way to customise these? If, say, I wanted to replace the Google button with one for DuckDuckGo, how would I go about this?

Best Answer

Gnome-Shell search providers are described by XML files in the folder /usr/share/gnome-shell/search_providers

You will notice two XML files - google.xml and wikipedia.xml

Lets create a new search provider - copy the google.xml file as a template

11.10

sudo cp /usr/share/gnome-shell/search_providers/google.xml /usr/share/gnome-shell/search_providers/duckduckgo.xml

12.04

sudo cp /usr/share/gnome-shell/open-search-providers/google.xml /usr/share/gnome-shell/open-search-providers/duckduckgo.xml

Now lets open the file and change some details to search with duckduckgo:

11.10

sudo nano /usr/share/gnome-shell/search_providers/duckduckgo.xml

12.04

sudo nano /usr/share/gnome-shell/open-search-providers/duckduckgo.xml

Change the following XML tags:

<ShortName>DuckDuckGo</ShortName>
<Description>DuckDuckGo Search</Description>
<Url type="text/html" method="GET" template="http://www.duckduckgo.com/?q={searchTerms}"/>

The only difficult part is finding out how a search engine searches - in duckduckgo I searched for something - you see in the title bar how the search provider adds its search terms

enter image description here

final result

enter image description here

In order to see the changes, you need to restart GNOME Shell by pressing Alt+F2, typing "r" and pressing enter.


Linked Questions:

  1. Is it possible to re-arrange the search providers on the GNOME Shell Activities Overview display?