For the complete documentation index, see llms.txt. This page is also available as Markdown.

Adding 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

1

Create a new class in lawnchair/app/lawnchair/qsb/providers/. Name it SearchEngineName.

2

Use the following template to define your engine. Replace the placeholders with your specific engine details.

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,
)
3

Add the required vector drawable to the lawnchair/res/drawable/ directory and the engine name string to lawnchair/res/values/strings.xml.

4

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.

sealed class QsbSearchProvider(...) {
    // ...
    companion object {
        fun values() = listOf(
            AppSearch,
            Bing,
            DuckDuckGo,
            Google,
            MyEngine, // Added provider
        )
    }
}

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

Last updated

Was this helpful?