kiwibrowser / src.next

Source-code for Kiwi Next, a Kiwi Browser auto-rebased with latest Chromium
BSD 3-Clause "New" or "Revised" License
2.25k stars 288 forks source link

Add support for adding custom search engine #184

Open KrasnayaPloshchad opened 3 years ago

KrasnayaPloshchad commented 3 years ago

Firefox for Android have a feature to add search engine manually, which used %s to represent any keywords. It would be nice if Kiwi Browser followed soon.

See: https://support.mozilla.org/en-US/kb/manage-my-default-search-engines-firefox-android

WisdomCode commented 3 years ago

It's not quite obvious, but Kiwi can add custom search engines that support the opensearch standard by default. This is a simple xml given out by most common searchengines. When a search is done on a searchengine providing this xml, you can actually see the search engine in your preferences->search engines at the bottom and add it. I have not tested that exhaustively, but what I did:

  1. opened a searx instance (like searx.be )
  2. typed in a search
  3. with the tab open, go into settings->search engine
  4. choose the site you just searched, right at the bottom of the screen under "recently visited"
  5. Done!

This should basically cover many, if not all scenarios. For everything else, one may manipulate the site using mitmproxy or similar for a one-time addition of the xml, but this is getting relatively complicated.

I hope this helps some other stranded searchers of a privacy friendly browsers.

esjarc commented 3 years ago

@WisdomCode For me that's not sufficient, as I like to specify custom search engines for different types of searches, e. g. for image or video search. So for Google Image Search I would add the following search engine: Name: Images Keyword: i URL: https://www.google.com/search?tbm=isch&tbs=isz:l&q=%s

Therefore it is important to me that the browser allows me to add custom search engines and that I can choose in the address bar which search engine I'd like to use. For desktop Firefox I have set up a website with opensearch xml files, but I can't add them in Kiwi either, as Kiwi requires a search to be made before importing the opensearch xml (Firefox allows to import the xml via right click on the address bar).

I've noticed that I can add search engines in kiwi://settings in Kiwi Browser. Unfortunately they don't appear in the list of search engines and it is not possible to edit or delete them after adding an entry.

M-A-R-T-I-N-1 commented 2 years ago

@WisdomCode For me that's not sufficient, as I like to specify custom search engines for different types of searches, e. g. for image or video search. So for Google Image Search I would add the following search engine: Name: Images Keyword: i URL: https://www.google.com/search?tbm=isch&tbs=isz:l&q=%s

Therefore it is important to me that the browser allows me to add custom search engines and that I can choose in the address bar which search engine I'd like to use. For desktop Firefox I have set up a website with opensearch xml files, but I can't add them in Kiwi either, as Kiwi requires a search to be made before importing the opensearch xml (Firefox allows to import the xml via right click on the address bar).

I've noticed that I can add search engines in kiwi://settings in Kiwi Browser. Unfortunately they don't appear in the list of search engines and it is not possible to edit or delete them after adding an entry.

I do definitely agree. Except that it can be removed by clicking the white button on white backgroud on the right of the entry and if you make it default (using the same button) it even works. Though without the engine selection by keywords it's useless for me.

plicit commented 2 years ago

I'm interested in this as well. I think the requested feature is more accurately called address bar or omnibox "custom keyword search".

As mentioned, Kiwi already has custom search engines, but only one is allowed active at a time. You can set keywords via kiwi:settings, but the keywords are not honored by the address bar handlers for some reason.

I'm not familiar with the code or debugging Android apps, but it looks like SearchURLFetcher::OnURLLoadComplete already has some code to find a TemplateURL for a search engine keyword. It just uses the default rather than extracting the keyword from the input string (I'm not sure how to even access the input string):

https://github.com/kiwibrowser/src.next/blob/50dd12b74c9028d062ed84e95014d37be16dfd31/components/search/search_url_fetcher.cc#L177

drc5521 commented 2 years ago

This is very necessary. Sometimes it is accessed many times and will not appear in the search engine list. It is necessary to add multiple engines by customization.

ghost commented 2 years ago

This actually exists. Head to chrome://settings/searchEngines & explore plethora of Search Engine customisation (ofc adding a new one too)

For example, you can add Brave as a default search engine like this Brave as a default search engine like this

plicit commented 2 years ago

@pc00per those settings are mentioned up-thread ( kiwi://settings ), but the Shortcut field doesn't work. Your example uses the whole domain "search.brave.com" which defeats the purpose of a Shortcut. In Chrome Desktop, you set the Shortcut field to a short name like "br" and then in the address bar you can type "br my search terms" and it will search the Brave %s URL using "my search terms". I use "am" to search amazon smile, "gg" to search google, etc.

ghost commented 2 years ago

Yah but at least we know there's a possibility of adding a search engine...

plicit commented 2 years ago

Ah, yeah, you can change the default search engine, just no keyword / shortcut switching between search engines.

WolfganP commented 2 years ago

Top missing feature for me as well in the Android version, as I would like to use a prefix for selecting a different engine in every search needed (ie images or some specific content). DuckDuckGo !bangs work but obviously is not a local search.

I even tried an extension like Custom Search Engine (https://chrome.google.com/webstore/detail/custom-search-engine/kelahdmegihhooaelnaahkeggodajdjf ) but it doesn't work either (it seems the 'ms' command isn't parsed and just passed as is to the default search engine).

Jimmy-ajia commented 2 years ago

您好,我已经收到您的邮件,尽快给您回复。

ghost commented 1 year ago

In previous versions of Kiwi I was able to use !bangs freely (without switching to DDG). Why did the dev remove it? IT WAS SO USEFUL.

Jimmy-ajia commented 1 year ago

您好,我已经收到您的邮件,尽快给您回复。

fredgolightly commented 1 year ago

Bangs would be super useful for users and really make Kiwi a power browser! I see some similar here chrome://settings/searchEngines but I can't edit the shortcuts nor see banga. Can this be added please?

Jimmy-ajia commented 1 year ago

您好,我已经收到您的邮件,尽快给您回复。