#dbus #gnome #search

search-provider

Rust wrapper around the GNOME Shell search provider API

16 releases (breaking)

Uses new Rust 2024

0.13.0-alpha.0 Jan 10, 2026
0.12.0 Jul 15, 2025
0.11.0 Feb 15, 2025
0.10.0 Jul 10, 2024
0.1.0 May 6, 2019

#1859 in GUI

Download history 84/week @ 2025-09-21 46/week @ 2025-09-28 25/week @ 2025-10-05 19/week @ 2025-10-12 32/week @ 2025-10-19 23/week @ 2025-10-26 16/week @ 2025-11-02 26/week @ 2025-11-09 3/week @ 2025-11-16 43/week @ 2025-11-23 6/week @ 2025-11-30 1/week @ 2025-12-07 20/week @ 2025-12-14 44/week @ 2025-12-21 3/week @ 2025-12-28

67 downloads per month
Used in 2 crates

GPL-3.0-or-later

27KB
292 lines

search-provider

Rust wrapper around the GNOME Shell search provider API


lib.rs:

The crate aims to provide an easy to use wrapper around the GNOME Shell Search Provider DBus interface.

How to use

use search_provider::{ResultID, ResultMeta, SearchProviderImpl};
use std::collections::HashMap;

#[derive(Debug)]
struct Application {
    results: HashMap<String, String>,
}
impl SearchProviderImpl for Application {
    fn activate_result(&self, identifier: ResultID, terms: &[String], timestamp: u32) {
        let result = self.results.get(&identifier);
        println!(
            "activating result {:#?} identified by {}",
            result, identifier
        );
    }

    fn initial_result_set(&self, terms: &[String]) -> Vec<ResultID> {
        // Here do your search logic
        if terms.contains(&"some_value".to_owned()) {
            vec!["some_key".to_owned()]
        } else {
            vec![]
        }
    }

    fn result_metas(&self, identifiers: &[ResultID]) -> Vec<ResultMeta> {
        self.results
            .iter()
            .map(|(identifier, value)| {
                ResultMeta::builder(identifier.to_owned(), "Some name")
                    .description("Some description of the current identifier")
                    .build()
            })
            .collect::<Vec<_>>()
    }
}
use search_provider::SearchProvider;
use std::collections::HashMap;

async fn main_entry() -> zbus::Result<()> {
    let mut results = HashMap::new();
    results.insert("some_key".to_string(), "some_value".to_string());
    let app = Application { results };
    let provider = SearchProvider::new(
        app,
        "org.gnome.design.IconLibrary.SearchProvider",
        "/org/gnome/design/IconLibrary/SearchProvider",
    )
    .await?;
    Ok(())
}

Dependencies

~11–28MB
~344K SLoC