Thursday, June 23, 2022

Update the default list of search engines in Chrome

Update the default list of search engines in Chrome

Chrome allows you to manage the list of searches available via the address bar. You can add new site searches and such by clicking the Add button. What you can't do is move a search engine from the "Site search" section to the "Search engines" section. You are effectively stuck with the list that Google curated. Here's how to fix that.

Side note: The data we want to edit is stored in a SQLite database. You'll need a copy of the SQLite command line tool for your OS in order to edit this database. Good news, SQLite is free software! Just run on over to the SQLite home page at https://sqlite.org and hit the download button.

In your browser go to chrome://settings/searchEngines



Click the "Add" button (highlighted above) to add your new search engine. You could also search the list of engines and see if it's already there (use the search box in the top right, also highlighted above).

Once you've added or activated your desired search engine, you need to EXIT chrome. That includes all instances that might be running. I don't just mean close the settings tab, I mean completely exit all running instances of Chrome. This is necessary because the file storing this information is locked when Chrome is running.

Now we need to edit the database storing this info. Go to your Chrome profile directory. In Windows 10 it is located in the C:\Users\%UserName%\AppData\Local\Google\Chrome\User Data\Default directory in the "Web Data" file.

>cd "\Users\%UserName%\AppData\Local\Google\Chrome\User Data\Default"
>sqlite3 "Web Data"
sqlite> .mode line
sqlite> select * from keywords where url like '%brave%'
                     id = 632
             short_name = Brave
                keyword = b
            favicon_url =
                    url = https://search.brave.com/search?q={searchTerms}
   safe_for_autoreplace = 0
        originating_url =
           date_created = 13300482199622719
            usage_count = 0
        input_encodings =
            suggest_url =
         prepopulate_id = 0
      created_by_policy = 0
          last_modified = 13300482199622719
              sync_guid = 680f8753-590d-4cc6-8be5-ca0154aa3f2a
         alternate_urls = []
              image_url =
 search_url_post_params =
suggest_url_post_params =
  image_url_post_params =
            new_tab_url =
           last_visited = 0
  created_from_play_api = 0
              is_active = 1
        starter_pack_id = 0
sqlite> update keywords set prepopulate_id=id where url like '%brave%';
sqlite> .q

In this case I added the Brave search engine to my list of default search engines by updating the "prepopulate_id" field to a non-zero value. To search for your preferred engine, substitute the domain or some other unique part for the word brave in the queries above. Note that you need to keep the single quotes and the percent signs. The single quote tells SQLite that this is a string value. The percent signs are wildcards for characters before and after the keyword you are looking for.

You could also remove search engines from the default list by, you guessed it, setting the prepopulate_id to zero.

sqlite> update keywords set prepopulate_id=0 where url like '%ecosia%';

Now start Chrome again and your selected search engines should show up in the list of default search engines.