> For the complete documentation index, see [llms.txt](https://docs.lawnchair.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lawnchair.app/developers/how-to/add-search-provider.md).

# Add a search provider

The dock search bar (hotseat qsb) supports multiple search providers.

New web-based search engines can be added by implementing the search provider contract and registering them in the centralized provider list.

### Implementation contract

Search providers are defined as Kotlin objects that inherit from the `QsbSearchProvider` sealed class. Each provider requires the following metadata:

* A unique string ID used for preference storage.
* A reference to a string resource for the display name.
* A reference to a vector drawable for the icon.
* A package name (leave empty for website-only providers).
* A search URL for the website fallback.
* A provider type, typically set to `QsbProviderType.WEBSITE`.

### Steps to add a provider

{% stepper %}
{% step %}
Create a new class in `lawnchair/app/lawnchair/qsb/providers/`. Name it `SearchEngineName`.
{% endstep %}

{% step %}
Use the following template to define your engine. Replace the placeholders with your specific engine details.

```kotlin
data object MyEngine : QsbSearchProvider(
    id = "my_engine",
    name = R.string.search_provider_my_engine,
    icon = R.drawable.ic_my_engine,
    packageName = "",
    website = "https://my-engine-url.com/search?q=",
    type = QsbProviderType.WEBSITE,
)
```

{% endstep %}

{% step %}
Add the required vector drawable to `lawnchair/res/drawable/` and it's name to `lawnchair/res/values/strings.xml`.
{% endstep %}

{% step %}
Register the provider in `QsbSearchProvider` and locate the `companion object`. Add your new engine to the list returned by the `values()` function. Maintain alphabetical order to keep the list organized.

<pre class="language-kotlin"><code class="lang-kotlin">sealed class QsbSearchProvider(...) {
    // ...
    companion object {
        fun values() = listOf(
            AppSearch,
            Bing,
            DuckDuckGo,
            Google,
<strong>            MyEngine, // Add your provider here
</strong>        )
    }
}
</code></pre>

{% endstep %}
{% endstepper %}

Once registered, the new provider will appear in the search provider selection menu within Lawnchair settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lawnchair.app/developers/how-to/add-search-provider.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
