freedesktop_icon_lookup/
lib.rs

1//! # freedesktop-icon-lookup
2//!
3//! A library for searching a path with given app name based on [Freedesktop icon lookup spec](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html).
4//! The implementation eagarly scans all directories in advance so multiple lookups are executed way faster and without real filesystem scan.
5//!
6//! # Feature list
7//!
8//! - Multiple themes support, including inherited;
9//! - Advanced lookup among all found
10//!
11//! # Example
12//!
13//! ```rust
14//! # use std::path::PathBuf;
15//! use freedesktop_icon_lookup::{Cache, LookupParam};
16//! # use freedesktop_icon_lookup::Result;
17//!
18//! # fn main() -> Result<()> {
19//! let theme = "Adwaita";
20//! let mut cache = Cache::new()?;
21//! cache.load(theme)?;
22//! let _: Option<PathBuf> = cache.lookup("firefox", theme);
23//! # Ok(())
24//! # }
25//! ```
26//!
27//! # Alternatives
28//!
29//! [freedesktop-icons](https://crates.io/crates/freedesktop-icons) might be a better option if you only need a few icons to search.
30
31pub use err::{Error, Result};
32pub use lookup::{Cache, LookupParam};
33pub use theme::IconInfo;
34
35pub(crate) use directory::Directory;
36pub(crate) use lookup::find_dir_icons;
37pub(crate) use theme::{IconSearch, Theme};
38
39mod directory;
40mod err;
41mod lookup;
42mod theme;